From 1735af7596d1c39fcff1e4f335062d6fa62d86be Mon Sep 17 00:00:00 2001 From: mikee47 Date: Thu, 27 Jun 2024 11:09:56 +0100 Subject: [PATCH] Tidy Host Emulator documentation Put everything into Host/README, arch/host/index is just a landing page. Clarify availability of ARCH_xx and SOC_xx macros. --- Sming/Arch/Host/README.rst | 172 +++++++++++++++++++++++++++-- Sming/building.rst | 11 ++ docs/source/arch/host/index.rst | 189 +------------------------------- 3 files changed, 177 insertions(+), 195 deletions(-) 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 #