-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Host MacOS support #2804
Add Host MacOS support #2804
Conversation
Take a look here: |
78ecdc8
to
5c7e58d
Compare
The networking works as follows. First, install tap extension:
There's some security guff to manually deal with, then a reboot is required. (NB. this doesn't work in CI environment but gracefully fails.) The Sming application must be run as sudo also. Changing permissions for
Then browsing to 192.168.13.10. This kernel extension creates The
So two questions remain:
Ref. ntop/n2n#773 |
a308f49
to
dc0633c
Compare
docs/source/arch/host/index.rst
Outdated
``Sming/Arch/Host/Tools/setup-network-linux.sh``. Here is the manual approach:: | ||
first, and requires root privilege. | ||
|
||
For Linux, uou can use ``Sming/Arch/Host/Tools/setup-network-linux.sh``. Here is the manual approach:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uou can use
-> you can use
|
||
Environment Variables | ||
--------------------- | ||
|
||
Open with a text editor the ``.profile`` file in your home directory, and add these lines:: | ||
|
||
export ESP_HOME=/opt/esp-quick-toolchain | ||
export SMING_HOME=<your-favourite-development-folder>/Sming/Sming | ||
export SMING_HOME=opt/Sming/Sming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export SMING_HOME=opt/Sming/Sming
Either change this command to export SMING_HOME=/opt/Sming/Sming
or revert this line.
|
||
Environment Variables | ||
--------------------- | ||
|
||
Open with a text editor the ``.profile`` file in your home directory, and add these lines:: | ||
|
||
export ESP_HOME=/opt/esp-quick-toolchain | ||
export SMING_HOME=<your-favourite-development-folder>/Sming/Sming | ||
export SMING_HOME=opt/Sming/Sming | ||
|
||
Make sure to replace ``<your-favourite-development-folder>`` in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change it to /opt/Sming/Sming
this sentence can be removed.
b457ad5
to
6b456e8
Compare
@slaff There's still a couple of APPVEYOR references in |
I will take care of this next week in a separate PR. |
Doesn't seem to use any of the standard variables but platform is always 64-bit.
Filter out unknown LDFLAGS --defsym argument order is reversed
Fix stat64, lseek64, ftruncate64 Define _DARWIN_C_SOURCE Only run disk image checks in Linux
Fix pthreads Use SIGUSRn Main loop signal support requires work (interrupt faking)
Use hard-coded IP settings tap0 interface is created dynamically when /dev/tap0 is opened. Still need to run with sudo permissions How to configure routing for internet access?
If this function fails then flashmem fails to initialise and the emulator fails without explanation. Therefore, add a suitable error message if this happens.
Implement gdb_do_break for arm64 Add lldb target Update documentation
Detects arm64 and tries to use NEON optimisations. No point in this since we want to exercise code which runs on actual devices.
du command doesn't have -b option in MacOS, but wc/awk is fine
installation of clang-format requires 'optional' option ninja installed at top level fix esp32 install Fix shellcheck globbing warnings Use arrays consistently Make non-apple CLANG available for RBPF library Don't change permissions on ``opt`` as the actual directory could be different (as per environment variables).
Introduced in SmingHub#2804
Bad Rp2040 cyw43 firmware build bug, introduced in #2804. Also ensure builds work with previous 10.3.1 toolchain.
This PR adds support for the Host Emulator to MacOS.
See #2773.
64-bit only
Standard compiler is 'Apple Clang', supports only 64-bit builds: no 32-bit compatibility.
GCC can be installed via
brew install gcc
and compiles as usual with the-m32
flag.The GNU linker is absent from brew's
coreutils
package (see Homebrew/homebrew-core#17794) so the standard system linker must be used. This only supports 64-bit targets.Apple have removed 32-bit application support from their ecosystem.
Advantages
No need for 32-bit compatibibility libraries in GNU/Linux.
For MacOS build and run host emulator using standard Apple tools, no GCC required.
General improvements in portability, less tolerant of incorrect type usage.
Disadvantages
Types such as long, size_t now 64-bit, don't match target hardware
Pointers are 64-bit so cannot be cast to 32-bit intrinsics. Code must use correct
intptr_t
types.Must use
ENABLE_STORAGE_SIZE64=1
as emulated flash addresses must be 64-bit.Symbol wrapping
MacOS linker doesn't support symbol wrapping which is used by
malloc_count
Component to hookmalloc
, etc.Don't currently have a solution for this so malloc_count is disabled for MacOS.
CI builds
Added MacOS builds plus running tests. For esp32 only IDF 5.2 is tested.
Notes
MacOS identified in makefiles with
UNAME=Darwin
.In code, use
#ifdef __APPLE__
when running on apple toolchains.Also requires
#ifdef __aarch64__
for Apple Silicon.The
rbpf
library requiresbpf
target with clang. Not supported by apple clang - use brew clang.I managed to get MacOS Ventura running in Qemu via https://github.com/kholia/OSX-KVM.
This runs in x86_64 mode, adequate for dev/testing.
The github actions runner
macos-latest
uses arm64, so introduces a few extra quirks.Tools
Compiler. Standard compiler is 'Apple Clang', supports only 64-bit builds: no 32-bit compatibility. Doesn't support
alias
attribute so use linker to do that instead.Archive. Standard
ar
does not supportLinker. GNU Linker not available. MacOS linker does not support symbol wrapping.
GDB. Can be installed with
brew
but requires some additional steps for security reasons. Separatelldb
target added.sed. GNU 'sed' tool has extensions which MacOS version does not support. Added
SED
build variable which should always point to GNU versiongsed
, but only for Darwin.TODO:
lldb
support to framework