diff --git a/Sming/Arch/Host/README.rst b/Sming/Arch/Host/README.rst index 7519c2063f..2bbb67f175 100644 --- a/Sming/Arch/Host/README.rst +++ b/Sming/Arch/Host/README.rst @@ -15,40 +15,192 @@ code prior to flashing a real device. This is not a machine emulator; if you need something operating at a lower level take a look at `QEMU `__. +The design goals for Host builds are: + +- Simplify development of complex applications +- Enable use of advanced testing and code quality tools (valgrind, code sanitizers) +- Support CI testing by actually executing code, not just building it + + Requirements ------------ -``CMake`` is required to build LWIP +``CMake`` and ``Ninja`` are required to build some libraries (e.g. lwip). + +Tested compilers: + +- GCC version 8 or later +- Clang version 15 or later +- Apple-clang version 14 or later + +.. _linux_requirements: + +Linux +~~~~~ + +Host executables can be built in 32-bit emulation mode, which is the default for Linux. +This requires installation of 32-bit runtime libraries. +For debian/ubuntu:: + + sudo apt install g++-multilib + +For Fedora:: + + sudo dnf install glibc-devel.i686 libstdc++.i686 -Ensure you are using relatively recent compilers, with 32-bit libraries available. -For Linux, you may require the ``gcc-multilib`` and ``g++-multilib`` -packages to build 32-bit executables on a 64-bit OS. Alternatively set :envvar:`BUILD64` to 1 to build in native 64-bit mode. +MacOS +~~~~~ + MacOS comes pre-installed with ``Apple Clang`` as the standard toolchain. This should be sufficient to build Sming in Host mode. Note that MacOS does not support 32-bit applications so the emulator will build in 64-bit mode. +Windows +~~~~~~~ + For Windows, make sure your ``MinGW`` distro is up to date. See :doc:`/getting-started/windows/index` for further details. + Building -------- -Build the framework and application as usual, specifying :envvar:`SMING_ARCH` =Host. For example:: +Environment variables +~~~~~~~~~~~~~~~~~~~~~ + +:envvar:`SMING_ARCH` must be set to use ``Host`` as the desired architecture:: - cd $SMING_HOME/../samples/Basic_Serial - make SMING_ARCH=Host + export SMING_ARCH=Host -This builds the application as an executable in, for example, -``out/Host/firmware/app.exe``. Various command-line options are -supported, use ``--help`` for details. +Debug Build +~~~~~~~~~~~ + +If you plan to use a debugger make sure to set :envvar:`ENABLE_GDB` and (optionally) +:envvar:`ENABLE_LWIPDEBUG` before compiling the code:: + + export ENABLE_GDB=1 + export ENABLE_LWIPDEBUG=1 #