4ms / metamodule

MetaModule virtual patch module firmware
Other
8 stars 0 forks source link

Document dev environment setup #57

Closed danngreen closed 2 months ago

danngreen commented 1 year ago
hemmer commented 1 year ago

I'm actually struggling to build the firmware on Mac M1 (branch main, submodules updated as of just now), so could be a guinea pig for this:

(base) ewanhemingway@Ewans-Mac-mini firmware % which arm-none-eabi-gcc
/Applications/ArmGNUToolchain/12.3.rel1/arm-none-eabi/bin/arm-none-eabi-gcc
(base) ewanhemingway@Ewans-Mac-mini firmware % arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(base) ewanhemingway@Ewans-Mac-mini firmware % uname -m
arm64

Problem seems to be it's using clang c compiler rather than the arm-none-eabi-gcc:

(base) firmware % make -j16
... Running patch_convert tests....
... Running firmware tests....
... Running CoreModule tests ...
... Running shared/cpputil tests ...
... Running mdrivlib tests ...
make[1]: tests/Makefile: No such file or directory
--------------------
Building for MP1 M4 core, "medium" module
make[1]: *** No rule to make target `tests/Makefile'.  Stop.
make: *** [module_tests] Error 2
make: *** Waiting for unfinished jobs....
[MP1M4-medium] Building src/core_m4/system_stm32mp1xx.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_adc.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_adc_ex.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_i2c.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_i2c_ex.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_ll_rcc.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_rcc.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_rcc_ex.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_pwr_ex.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_ll_tim.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_mdma.c at -O3
[MP1M4-medium] Building lib/stm32-hal/stm32mp1/src/stm32mp1xx_hal_dma.c at -O3
**clang: error: the clang compiler does not support '-mcpu=cortex-m4'
clang: error: the clang compiler does not support '-mcpu=cortex-m4'**

full log here: https://gist.github.com/hemmer/b7f5bff45d900efe15962fe0de2a1590

But from the Makefile it looks to have CC

danngreen commented 1 year ago

I saw this error once, and there is a fix for it by setting an environment variable to the path the arm-none-eabi toolchain. But, I'd like to get to the bottom of it and figure out why that's only needed on some macOS systems.

Can you try the test-arm-path-1 branch? I just pushed a commit that should fix this, and also #56

hemmer commented 1 year ago

Can you try the test-arm-path-1 branch? I just pushed a commit that should fix this, and also https://github.com/4ms/metamodule/issues/56

I've checked and can build successfully on that branch. (edit just FYI I didn't add the METAMODULE_ARM_NONE_EABI_PATH env var that is mentioned in your readme changes)

danngreen commented 1 year ago

Cool! I'll merge that in. I was depending on a specific version of GNU Make. Now it should work with earlier versions too (though, not non-GNU Make)

hemmer commented 1 year ago

For reference

(base) ewanhemingway@Ewans-Mac-mini firmware % make --version
GNU Make 3.81
danngreen commented 1 year ago

I added a Setup.md file with the MacOS section filled out. I setup a virtual MacOS machine (clean install of Ventura) in order to test it. It's working, so I'm going to merge this in

danngreen commented 1 year ago

Leaving this open, as we still need Windows and Linux setup guides. I don't know windows dev, so I won't be able to help there much except by running Windows in a VM to test things.

mhetrick commented 1 year ago

Windows instructions are now available here: https://github.com/4ms/metamodule/commit/ed8f623e0c28b16f297116a80e286e6255d56767

danngreen commented 1 year ago

Thanks! I'll cherry-pick this in (I also added a bit about checking to make sure the path to arm-none-eabi is right)

danngreen commented 2 months ago

Closing this: issue is stale and docs have instructions for all platforms. If something specific is missing or needs more docs, we can open a new issue