You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to ask, can you provide some examples that show how to cross-compile for embedded use-cases? For example, would it just be setting the 'CC' environment variable? How would I specify something like a linker script, and the C-start-up code?
This is all commonly done for embedded environments (baremetals, without an OS, etc).
Perhaps to give a more concrete example of cross-compiling to Windows for ARM64 in case somebody runs across this:
Clone the zig-cross project in your home directory: git clone https://github.com/mrexodia/zig-cross ~/zig-cross
Configure your CMake (or cmkr, same thing) project with the following command line: cmake -G Ninja -B build-winarm64 -DCMAKE_TOOLCHAIN_FILE=~/zig-cross/cmake/zig-toolchain-winarm64.cmake
Build the project: cmake --build build-winarm64
There are many other cross-compilation toolchains out there, they all work in the same way. The most important thing is that you do not hardcode toolchain/platform-specific flags in your project and everything will work smoothly.
Hi,
This is a great project!
I wanted to ask, can you provide some examples that show how to cross-compile for embedded use-cases? For example, would it just be setting the 'CC' environment variable? How would I specify something like a linker script, and the C-start-up code?
This is all commonly done for embedded environments (baremetals, without an OS, etc).
This is an example (not mine) of CMake for an ARM cortex-m0: https://github.com/infohoschie/arm-cortex-m0-cmake
The text was updated successfully, but these errors were encountered: