Compile error with v3.2 on 3aea047


a couple days/weeks ago, I would edit Inc/main.h to set the minor revision to 2 (instead of 4), and then my odrive v3.2 would compile, flash and work just fine.

I freshly updated master with a git pull, now the main.h file seem to be located in v3.3 sub folder (i hope the master is still compatible with odrive v3.2)
i had to install tup as stated in the README file.

But now i have a compile error (see details below).

MotorControl/utils.c:193:21: error: 'TIM_TIME_BASE' undeclared

if i revert main.h to hardware version 3.4 then it compiles fine (but i would rather not reflash my v3.2 board with this fw)

Is master broken with 3.2 boards again ? :smiley:
What should i do?


root@MTBD00694:~/ODrive/Firmware# make clean
rm -fR .dep build
root@MTBD00694:~/ODrive/Firmware# make
Initializing .tup in /root/ODrive
.tup repository initialized.
 [              ETA~=<1s Remaining=0                 ] 100%                                                                                                                                                       
  7) [0.047s] Firmware: arm-none-eabi-gcc -std=c99 -c Board/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F405xx -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -fdata-sections -ffunction-sections -Og -ffast-math -fstack-usage -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/include -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IBoard/v3.3/Drivers/DRV8301 -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -IBoard/v3.3/Drivers/CMSIS/Device/ST/STM32F4xx/Include -IBoard/v3.3/Drivers/CMSIS/Include -IBoard/v3.3/Inc -IMotorControl  -o build/Board_v3.3_Middlewares_Third_Party_FreeRTOS_Source_portable_GCC_ARM_CM4F_port.c.o
Board/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c: In function 'prvPortStartFirstTask':
Board/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:306:1: warning: stack usage computation not supported for this target
* 56) Firmware: arm-none-eabi-gcc -std=c99 -c MotorControl/utils.c -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F405xx -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -fdata-sections -ffunction-sections -Og -ffast-math -fstack-usage -IMotorControl -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/include -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IBoard/v3.3/Drivers/DRV8301 -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -IBoard/v3.3/Drivers/CMSIS/Device/ST/STM32F4xx/Include -IBoard/v3.3/Drivers/CMSIS/Include -IBoard/v3.3/Inc -IMotorControl  -o build/MotorControl_utils.c.o
MotorControl/utils.c: In function 'micros':
MotorControl/utils.c:193:21: error: 'TIM_TIME_BASE' undeclared (first use in this function)
         cycle_cnt = TIM_TIME_BASE->CNT;
MotorControl/utils.c:193:21: note: each undeclared identifier is reported only once for each function it appears in
 *** tup errors ***
 *** Command ID=526 failed with return value 1
tup error: Expected to write to file 'build/MotorControl_utils.c.o' from cmd 526 but didn't
 *** Additionally, command 526 failed to process input dependencies. These should probably be fixed before addressing the command failure.
 57) [0.092s] Firmware: arm-none-eabi-gcc -std=c99 -c MotorControl/legacy_commands.c -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F405xx -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -fdata-sections -ffunction-sections -Og -ffast-math -fstack-usage -IMotorControl -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/include -IBoard/v3.3/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IBoard/v3.3/Drivers/DRV8301 -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -IBoard/v3.3/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc -IBoard/v3.3/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -IBoard/v3.3/Drivers/CMSIS/Device/ST/STM32F4xx/Include -IBoard/v3.3/Drivers/CMSIS/Include -IBoard/v3.3/Inc -IMotorControl  -o build/MotorControl_legacy_commands.c.o
MotorControl/legacy_commands.c:110:1: warning: missing braces around initializer [-Wmissing-braces]
 monitoring_slot monitoring_slots[20] = {0};
MotorControl/legacy_commands.c:110:1: warning: (near initialization for 'monitoring_slots[0]') [-Wmissing-braces]
 [                 ETA~=<1s Remaining=6  Active=0                  ]  90%                                                                                                                                         
 *** tup: 1 job failed.
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 1
root@MTBD00694:~/ODrive/Firmware# git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   Board/v3.3/Inc/main.h

no changes added to commit (use "git add" and/or "git commit -a")
root@MTBD00694:~/ODrive/Firmware# git diff Board/v3.3/Inc/m
main.h         mxconstants.h  
root@MTBD00694:~/ODrive/Firmware# git diff Board/v3.3/Inc/main.h
diff --git a/Firmware/Board/v3.3/Inc/main.h b/Firmware/Board/v3.3/Inc/main.h
index 75bd226..8c86818 100644
--- a/Firmware/Board/v3.3/Inc/main.h
+++ b/Firmware/Board/v3.3/Inc/main.h
@@ -53,7 +53,7 @@
 /* USER CODE BEGIN Includes */
 // #define HW_VERSION_HIGH_VOLTAGE true

either it’s a regression or i don’t know how to properly configure the latest version of master to use v3.2 board

because when i use commit be53d96, the compile works again

Sorry about that, that was indeed an issue because we didn’t test properly on v3.2. master should be fixed now, please update and try again.

We are actually just about to make some automated tests that will let us automatically compile for all board versuions before a release can go through, so hopefully this will be a thing of the past from now on.


problem seems gone with 3593a68

besides, it seems most compile-time params i was fine tuning at compile time seems to be configurable at runtime now.

.vel_limit => from 20000 to 200000 (10x faster)
.current_lim => from 10 to 75
encoder_cpr => i would use 2048 * 4 to match my CUI encoders (looks like it became default value compared to previous chinese encoders)

ideally i wouldn’t have to modify the firmware source and do everything at runtime. we’ll see