Skip to content
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

fome-fw doesnt compile on mac with m1 chip #466

Open
D0kRay opened this issue Aug 16, 2024 · 5 comments
Open

fome-fw doesnt compile on mac with m1 chip #466

D0kRay opened this issue Aug 16, 2024 · 5 comments

Comments

@D0kRay
Copy link

D0kRay commented Aug 16, 2024

If I run any task from vscode for example 'Build Hellen NB1' it always fails after the bootloader compilation with the following error:

Creating blbuild/fome_bl.list

   text    data     bss     dec     hex filename
  18416      64  131008  149488   247f0 blbuild/fome_bl.elf

Done
../../common_make.sh: line 48: 0xTEXT: value too great for base (error token is "0xTEXT") 

The following toolchain is used: arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
And this is the commandline output:

 *  Executing task: bash ./compile_hellen-nb1.sh 

Entering common_make.sh with board hellen/hellen-nb1 and CPU ARCH_STM32F4
Board dir is /Users/macuser/Documents/VSCode/fome-fw/firmware/config/boards/hellen/hellen-nb1
FW dir is /Users/macuser/Documents/VSCode/fome-fw/firmware
Calling make for the main firmware...
found /Users/macuser/Documents/VSCode/fome-fw/firmware/config/boards/hellen/hellen-nb1/connectors/generated_ts_name_by_pin.cpp 
PROJECT_BOARD: hellen/hellen-nb1
BOARD_DIR:     /Users/macuser/Documents/VSCode/fome-fw/firmware/config/boards/hellen/hellen-nb1
PROJECT_CPU:   ARCH_STM32F4
SHORT_BOARD_NAME: hellen-nb1
CPU_HWLAYER:   ports/stm32/stm32f4
CONFDIR:       ./hw_layer/ports/stm32/stm32f4/cfg
LDSCRIPT:      ./hw_layer/ports/stm32/stm32f4/STM32F4.ld
UNAME_SM:          Darwin arm64
COMPILER_PLATFORM: arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
TRGT:              ./ext/build-tools/arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi/bin/arm-none-eabi-
echo "#pragma once" > gitversion.h.gen
printf '#include "fan_control.h"\n #include "fuel_pump.h"\n #include "gear_detector.h"\n #include "trip_odometer.h"\n' > engine_modules_generated.h.gen
printf 'FanControl1,FanControl2, FuelPumpController, GearDetector, TripOdometer,' > modules_list_generated.h.gen
echo "#define GIT_HASH \"$(git rev-parse HEAD)\"" >> gitversion.h.gen
rsync --checksum engine_modules_generated.h.gen engine_modules_generated.h
rsync --checksum modules_list_generated.h.gen modules_list_generated.h
Compiling pch.h
echo "#define GIT_HASH_SHORT \"$(git rev-parse --short HEAD)\"" >> gitversion.h.gen
rsync --checksum gitversion.h.gen gitversion.h
Compiling generated_ts_name_by_pin.cpp
Compiling ch.cpp
Compiling null_device.cpp
Compiling compressed_block_device.cpp
Compiling mass_storage_device.cpp
Compiling mass_storage_init.cpp
Compiling lua.cpp
Compiling lua_hooks.cpp
Compiling can_filter.cpp
Compiling lua_hooks_util.cpp
Compiling script_impl.cpp
Compiling output_lookup.cpp
Compiling value_lookup.cpp
Compiling lua_can_rx.cpp
Compiling state_sequence.cpp
Compiling big_buffer.cpp
Compiling engine_math.cpp
Compiling speed_density.cpp
Compiling closed_loop_fuel.cpp
Compiling closed_loop_fuel_cell.cpp
Compiling lambda_monitor.cpp
Compiling throttle_model.cpp
Compiling ford_aspire.cpp
Compiling custom_engine.cpp
Compiling bmw_m73.cpp
Compiling bmw_m73_mre.cpp
Compiling bmw_n73.cpp
Compiling mazda_miata.cpp
Compiling mazda_miata_base_maps.cpp
Compiling mazda_miata_1_6.cpp
Compiling mazda_miata_na8.cpp
Compiling mazda_miata_vvt.cpp
Compiling mazda_miata_custom_hunchback.cpp
Compiling citroenBerlingoTU3JP.cpp
Compiling dodge_neon.cpp
./config/engines/mazda_miata_vvt.cpp:577:13: warning: 'void setMiataNB2_MRE_common()' defined but not used [-Wunused-function]
  577 | static void setMiataNB2_MRE_common() {
      |             ^~~~~~~~~~~~~~~~~~~~~~
Compiling ford_1995_inline_6.cpp
Compiling gm_ls_4.cpp
Compiling nissan_primera.cpp
Compiling nissan_vq.cpp
Compiling harley.cpp
Compiling mercedes.cpp
Compiling honda_k_dbc.cpp
Compiling hyundai.cpp
Compiling subaru.cpp
Compiling GY6_139QMB.cpp
Compiling mazda_626.cpp
Compiling sachs.cpp
Compiling test_engine.cpp
Compiling mitsubishi.cpp
Compiling dodge_ram.cpp
Compiling m111.cpp
Compiling vw.cpp
Compiling vw_b6.cpp
Compiling chevrolet_camaro_4.cpp
Compiling toyota_jzs147.cpp
Compiling ford_festiva.cpp
Compiling advance_map.cpp
Compiling malfunction_central.cpp
Compiling auto_generated_enums.cpp
Compiling auto_generated_commonenum.cpp
Compiling auto_generated_enginetypes.cpp
Compiling fuel_math.cpp
Compiling accel_enrichment.cpp
In file included from ./controllers/algo/accel_enrichment.h:12,
                 from ./controllers/algo/engine.h:17,
                 from ./pch/pch.h:27:
./util/containers/cyclic_buffer.h: In instantiation of 'T cyclic_buffer<T, maxSize>::get(int) const [with T = float; unsigned int maxSize = 128]':
./controllers/algo/accel_enrichment.cpp:121:25:   required from here
./util/containers/cyclic_buffer.h:106:22: warning: comparison of integer expressions of different signedness: 'int' and 'const size_t' {aka 'const unsigned int'} [-Wsign-compare]
  106 |         while (index >= m_size) {
      |                ~~~~~~^~~~~~~~~
Compiling wall_fuel.cpp
Compiling launch_control.cpp
Compiling antilag_system.cpp
Compiling dynoview.cpp
Compiling runtime_state.cpp
Compiling engine_configuration.cpp
Compiling engine.cpp
Compiling engine2.cpp
Compiling event_registry.cpp
Compiling airmass.cpp
Compiling alphan_airmass.cpp
Compiling maf_airmass.cpp
Compiling speed_density_airmass.cpp
Compiling speed_density_base.cpp
Compiling fuel_computer.cpp
Compiling injector_model.cpp
Compiling dfco.cpp
Compiling default_base_engine.cpp
Compiling default_cranking.cpp
Compiling default_fuel.cpp
Compiling default_ignition.cpp
Compiling functional_sensor.cpp
Compiling sensor.cpp
Compiling thermistors.cpp
Compiling allsensors.cpp
Compiling auto_generated_sensor.cpp
Compiling AemXSeriesLambda.cpp
Compiling map.cpp
Compiling maf.cpp
Compiling Lps25Sensor.cpp
Compiling tps.cpp
Compiling ego.cpp
Compiling sensor_info_printing.cpp
Compiling sensor_checker.cpp
Compiling redundant_sensor.cpp
Compiling frequency_sensor.cpp
Compiling hella_oil_level.cpp
Compiling software_knock.cpp
Compiling linear_func.cpp
Compiling resistance_func.cpp
Compiling thermistor_func.cpp
Compiling identity_func.cpp
Compiling vr_pwm.cpp
Compiling tunerstudio_io.cpp
Compiling tunerstudio_io_serial.cpp
Compiling tunerstudio_io_serial_ports.cpp
Compiling live_data.cpp
Compiling ts_can_channel.cpp
Compiling serial_can.cpp
Compiling tunerstudio.cpp
Compiling tunerstudio_commands.cpp
Compiling bluetooth.cpp
Compiling signature.cpp
./console/binary/signature.cpp:23:62: note: '#pragma message: SHORT_BOARD_NAME: hellen-nb1'
   23 | #pragma message ("SHORT_BOARD_NAME: " QUOTE(SHORT_BOARD_NAME))
      |                                                              ^
./console/binary/signature.cpp:32:47: note: '#pragma message: TS_SIGNATURE: rusEFI (FOME) STM32Mega_portation.2024.08.13.hellen-nb1.3519287404'
   32 | #pragma message ("TS_SIGNATURE: " TS_SIGNATURE)
      |                                               ^
Compiling trigger_scope.cpp
Compiling pin_repository.cpp
Compiling microsecond_timer.cpp
Compiling digital_input_exti.cpp
Compiling trigger_input.cpp
Compiling trigger_input_exti.cpp
Compiling hardware.cpp
Compiling kline.cpp
Compiling smart_gpio.cpp
Compiling mmc_card.cpp
Compiling adc_inputs.cpp
Compiling adc_subscription.cpp
Compiling ads1015.cpp
Compiling mc33816.cpp
Compiling stepper.cpp
Compiling stepper_dual_hbridge.cpp
Compiling io_pins.cpp
Compiling rtc_helper.cpp
Compiling debounce.cpp
Compiling wifi_bsp.cpp
Compiling usbconsole.cpp
Compiling stm32_pins.cpp
Compiling stm32_common.cpp
Compiling stm32_icu.cpp
Compiling backup_ram.cpp
Compiling microsecond_timer_stm32.cpp
Compiling osc_detector.cpp
Compiling flash_int_common.cpp
Compiling usbcfg.cpp
Compiling mpu_util.cpp
Compiling stm32_adc_v2.cpp
Compiling flash_int_f4_f7.cpp
Compiling accelerometer.cpp
Compiling lps25.cpp
Compiling max31855.cpp
Compiling efi_output.cpp
Compiling injection_gpio.cpp
Compiling efi_gpio.cpp
Compiling periodic_task.cpp
Compiling dc_motor.cpp
Compiling scheduler.cpp
Compiling trigger_scheduler.cpp
Compiling efitime.cpp
Compiling listener_array.cpp
Compiling local_version_holder.cpp
Compiling biquad.cpp
Compiling error_accumulator.cpp
Compiling efi_pid.cpp
Compiling interpolation.cpp
Compiling datalogging.cpp
Compiling loggingcentral.cpp
Compiling cli_registry.cpp
Compiling efilib.cpp
Compiling timer.cpp
Compiling os_util.cpp
Compiling trigger_mazda.cpp
Compiling trigger_chrysler.cpp
Compiling trigger_structure.cpp
Compiling instant_rpm_calculator.cpp
Compiling auto_generated_sync_edge.cpp
Compiling trigger_decoder.cpp
./controllers/trigger/trigger_decoder.cpp: In member function 'void TriggerFormDetails::prepareEventAngles(TriggerWaveform*)':
./controllers/trigger/trigger_decoder.cpp:109:41: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  109 |         if (triggerShapeSynchPointIndex == EFI_ERROR_CODE) {
Compiling trigger_simulator.cpp
Compiling trigger_mitsubishi.cpp
Compiling trigger_nissan.cpp
Compiling trigger_subaru.cpp
./controllers/trigger/decoders/trigger_subaru.cpp: In function 'void initialize_one_of_36_2_2_2(TriggerWaveform*, int, int, bool)':
./controllers/trigger/decoders/trigger_subaru.cpp:12:98: warning: unused parameter 'knownOperationModeHack' [-Wunused-parameter]
   12 | static void initialize_one_of_36_2_2_2(TriggerWaveform *s, int firstCount, int secondCount, bool knownOperationModeHack) {
      |                                                                                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Compiling trigger_suzuki.cpp
Compiling trigger_toyota.cpp
Compiling trigger_gm.cpp
Compiling trigger_honda.cpp
Compiling trigger_rover.cpp
Compiling trigger_renix.cpp
Compiling trigger_vw.cpp
Compiling trigger_mercedes.cpp
Compiling trigger_misc.cpp
Compiling trigger_universal.cpp
Compiling trigger_emulator_algo.cpp
Compiling trigger_central.cpp
Compiling electronic_throttle.cpp
Compiling ac_control.cpp
Compiling alternator_controller.cpp
Compiling boost_control.cpp
Compiling dc_motors.cpp
Compiling harley_acr.cpp
Compiling idle_thread_io.cpp
Compiling idle_hardware.cpp
Compiling idle_thread.cpp
Compiling ignition_controller.cpp
Compiling main_relay.cpp
Compiling vvt.cpp
Compiling gppwm_channel.cpp
Compiling gppwm.cpp
Compiling tachometer.cpp
Compiling speedometer.cpp
Compiling malfunction_indicator.cpp
Compiling single_timer_executor.cpp
Compiling pwm_generator_logic.cpp
./controllers/system/timer/pwm_generator_logic.cpp: In member function 'void PwmConfig::handleCycleStart()':
./controllers/system/timer/pwm_generator_logic.cpp:157:76: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'long unsigned int'} [-Wsign-compare]
  157 |         if (forceCycleStart || safe.periodNt != periodNt || safe.iteration == iterationLimit) {
      |                                                             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
Compiling event_queue.cpp
Compiling settings.cpp
Compiling error_handling.cpp
Compiling map_averaging.cpp
Compiling high_pressure_fuel_pump.cpp
Compiling rpm_calculator.cpp
Compiling spark_logic.cpp
Compiling knock_controller.cpp
Compiling main_trigger_callback.cpp
Compiling prime_injection.cpp
Compiling fuel_schedule.cpp
Compiling flash_main.cpp
Compiling bench_test.cpp
Compiling obd2.cpp
Compiling can_verbose.cpp
Compiling can_rx.cpp
Compiling can_bench_test.cpp
Compiling rusefi_wideband.cpp
Compiling can_tx.cpp
Compiling can_dash.cpp
Compiling can_vss.cpp
Compiling engine_controller.cpp
Compiling engine_controller_misc.cpp
Compiling persistent_store.cpp
Compiling serial_rx.cpp
Compiling serial_sensor.cpp
Compiling start_stop.cpp
Compiling buttonshift.cpp
Compiling tcu.cpp
Compiling gear_controller.cpp
Compiling simple_tcu.cpp
Compiling tc_4l6x.cpp
Compiling shutdown_controller.cpp
Compiling limp_manager.cpp
Compiling init_sensors.cpp
Compiling init_fluid_pressure.cpp
Compiling init_tps.cpp
Compiling init_thermistors.cpp
Compiling init_lambda.cpp
Compiling init_maf.cpp
Compiling init_map.cpp
Compiling init_flex.cpp
Compiling init_vbatt.cpp
Compiling init_baro.cpp
Compiling init_fuel_level.cpp
Compiling init_aux.cpp
Compiling init_vehicle_speed_sensor.cpp
Compiling init_aux_speed_sensor.cpp
Compiling init_turbocharger_speed_sensor.cpp
Compiling init_input_shaft_speed_sensor.cpp
Compiling board_configuration.cpp
Compiling hellen_common.cpp
Compiling hellen_board_id.cpp
Compiling sensor_chart.cpp
Compiling engine_emulator.cpp
Compiling engine_sniffer.cpp
Compiling logic_analyzer.cpp
Compiling perf_trace.cpp
Compiling core.cpp
Compiling sent.cpp
Compiling i2c_bb.cpp
./hw_layer/drivers/gpio/core.cpp:15:44: note: '#pragma message: (0 + 0 + 1 + 0 + 0 + 1 + 0)'
   15 | #pragma message(STRING(BOARD_EXT_GPIOCHIPS))
      |                                            ^
Compiling can_msg_tx.cpp
Compiling can_hw.cpp
Compiling can_config.cpp
Compiling serial_hw.cpp
Compiling tle6240.cpp
Compiling tle8888.cpp
Compiling mc33972.cpp
Compiling mc33810.cpp
Compiling drv8860.cpp
Compiling tle9104.cpp
Compiling l9779.cpp
Compiling protected_gpio.cpp
Compiling sent_hw_icu.cpp
Compiling tooth_logger.cpp
Compiling log_field.cpp
Compiling status_loop.cpp
Compiling console_io.cpp
Compiling eficonsole.cpp
Compiling connector_uart_dma.cpp
Compiling binary_logging.cpp
Compiling usb_console.cpp
Compiling wifi_console.cpp
Compiling fan_control.cpp
Compiling fuel_pump.cpp
Compiling gear_detector.cpp
Compiling trip_odometer.cpp
Compiling util_dummy.cpp
Compiling crc.cpp
Compiling fragments.cpp
Compiling math.cpp
Compiling pt2001.cpp
Compiling rusefi.cpp
Compiling main.cpp
Linking build/fome.elf
lto-wrapper: warning: Options to '-Xassembler' do not match: -alms=build/lst/gcc_version_check.lst, -alms=build/lst/crt1.lst, dropping all '-Xassembler' and '-Wa' options.
Creating Creating Creating Creating build/fome.srec
build/fome.dmp
build/fome.hex
build/fome.list
Creating build/fome.bin

   text    data     bss     dec     hex filename
 509058    2684  183888  695630   a9d4e build/fome.elf

Done
Calling make for the bootloader...
found /Users/macuser/Documents/VSCode/fome-fw/firmware/config/boards/hellen/hellen-nb1/connectors/generated_ts_name_by_pin.cpp 
UNAME_SM:          Darwin arm64
COMPILER_PLATFORM: arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
TRGT:              ../ext/build-tools/arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi/bin/arm-none-eabi-
echo "#pragma once" > gitversion.h.gen
printf '' > engine_modules_generated.h.gen
printf '' > modules_list_generated.h.gen
echo "#define GIT_HASH \"$(git rev-parse HEAD)\"" >> gitversion.h.gen
rsync --checksum engine_modules_generated.h.gen engine_modules_generated.h
rsync --checksum modules_list_generated.h.gen modules_list_generated.h
Compiling pch.h
echo "#define GIT_HASH_SHORT \"$(git rev-parse --short HEAD)\"" >> gitversion.h.gen
rsync --checksum gitversion.h.gen gitversion.h
In file included from ../controllers/trigger/trigger_decoder.h:10,
                 from ../controllers/engine_cycle/rpm_calculator.h:15,
                 from ../controllers/algo/engine.h:13,
                 from ../pch/pch.h:27:
../controllers/trigger/decoders/trigger_structure.h: In function 'void wrapAngle(angle_t&, const char*, ObdCode)':
../controllers/trigger/decoders/trigger_structure.h:31:64: warning: unused parameter 'code' [-Wunused-parameter]
   31 | inline void wrapAngle(angle_t& angle, const char* msg, ObdCode code) {
      |                                                        ~~~~~~~~^~~~
Compiling usbconsole.cpp
Compiling ch.cpp
Compiling generated_ts_name_by_pin.cpp
Compiling stm32_pins.cpp
Compiling stm32_common.cpp
Compiling stm32_icu.cpp
Compiling backup_ram.cpp
Compiling microsecond_timer_stm32.cpp
Compiling osc_detector.cpp
Compiling flash_int_common.cpp
Compiling usbcfg.cpp
Compiling mpu_util.cpp
Compiling stm32_adc_v2.cpp
Compiling flash_int_f4_f7.cpp
Compiling board_configuration.cpp
Compiling hellen_common.cpp
Compiling hellen_board_id.cpp
Compiling efilib.cpp
Compiling pin_repository.cpp
Compiling util_dummy.cpp
Compiling crc.cpp
Compiling fragments.cpp
Compiling math.cpp
Compiling pt2001.cpp
Compiling openblt_chibios.cpp
Compiling openblt_flash.cpp
Compiling openblt_usb.cpp
Compiling bootloader_stubs.cpp
Compiling bootloader_main.cpp
Linking blbuild/fome_bl.elf
lto-wrapper: warning: Options to '-Xassembler' do not match: -alms=blbuild/lst/crt1.lst, -alms=blbuild/lst/hal.lst, dropping all '-Xassembler' and '-Wa' options.
Creating blbuild/fome_bl.hex
Creating blbuild/fome_bl.bin
Creating blbuild/fome_bl.dmp
Creating blbuild/fome_bl.list

   text    data     bss     dec     hex filename
  18416      64  131008  149488   247f0 blbuild/fome_bl.elf

Done
../../common_make.sh: line 48: 0xTEXT: value too great for base (error token is "0xTEXT")

 *  The terminal process "/bin/zsh '-l', '-c', 'bash ./compile_hellen-nb1.sh'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 
@D0kRay
Copy link
Author

D0kRay commented Aug 16, 2024

the following version of objdump is on my mac:
objdump --version
Apple LLVM version 15.0.0
Optimized build.
Default target: arm64-apple-darwin23.5.0
Host CPU: apple-m1

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

@D0kRay
Copy link
Author

D0kRay commented Aug 16, 2024

fixed the objdump problem by adding arm-none-eabi in front of objdump and objcopy.

now hex2dfu doesn't work:

Done
Base address is 0x08000000
Checksum address is 0x800001C
common_make.sh: invoking hex2dfu to place image checksum
../common_make.sh: line 54: ../misc/encedo_hex2dfu/hex2dfu.bin: cannot execute binary file

@D0kRay
Copy link
Author

D0kRay commented Aug 16, 2024

now it compiles completely.
The following stuff needs to be installed to compile fome one macos sonoma

brew
brew install mtools
brew install dosfstools

compile hex2dfu for arm cpu
gcc hex2dfu.c -o hex2dfu.bin

common_make.sh
$HEX2DFU -i build/fome.hex -c $checksumAddress -o build/fome.bin

@D0kRay D0kRay closed this as completed Aug 16, 2024
@mck1117
Copy link
Collaborator

mck1117 commented Aug 16, 2024

I don't think this is completed? We can improve the script to do the right things here. The arm-none-eabi compiler is downloaded in a submodule, so if we do the same trick as we do in the makefile (detect what system you're on and select compiler appropriately), we can use the bundled objdump too.

@mck1117 mck1117 reopened this Aug 16, 2024
@D0kRay
Copy link
Author

D0kRay commented Aug 16, 2024

I make a PR with the necessary Changes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants