Page 5 of 5
Re: Support for STM32G0B1
Posted: Tue Nov 07, 2023 9:50 am
by Giovanni
Hi,
Could you post your halconf.h, mcuconf.h files causing compilation errors?
Giovanni
Re: Support for STM32G0B1
Posted: Tue Nov 07, 2023 3:28 pm
by charlesrwest
Certainly.
For reference, the RT-STM32G0B1RE-NUCLEO64 demo exhibits this behavior.
With a fresh copy and the only change being the ChibiOS directory path it compiles fine.
[spoil]egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
Compiler Options
arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -fno-common -flto -Wall -Wextra -Wundef -Wstrict-prototypes -Wcast-align=strict -Wa,-alms=./build/lst/ -DCORTEX_USE_FPU=FALSE -MD -MP -MF ./.dep/build.d -I. -I./cfg -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/license -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/portability/GCC -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/startup/ARMCMx/compilers/GCC -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/startup/ARMCMx/devices/STM32G0xx -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/ext/ARM/CMSIS/Core/Include -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/ext/ST/STM32G0xx -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/include -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/common/ARMCMx -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/STM32G0xx -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/ADCv5 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/DACv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/DMAv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/EXTIv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/GPIOv2 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/I2Cv2 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/RCCv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/RNGv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/RTCv3 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/SPIv2 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/SYSTICKv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/TIMv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/USART -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/USARTv3 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/USBv2 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/xWDGv1 -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/boards/ST_NUCLEO64_G0B1RE -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/osal/rt-nil -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/rt/include -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/oslib/include -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/portability/GCC -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/ports/ARM-common -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/ports/ARMv6-M -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/test/include -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//test/rt/source/test -I/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//test/oslib/source/test main.c -o main.o
Compiling crt0_v6m.S
Compiling vectors.S
Compiling chcoreasm.S
Compiling crt1.c
Compiling hal.c
Compiling hal_st.c
Compiling hal_buffered_serial.c
Compiling hal_buffers.c
Compiling hal_queues.c
Compiling hal_flash.c
Compiling hal_mmcsd.c
Compiling hal_pal.c
Compiling hal_serial.c
Compiling nvic.c
Compiling stm32_isr.c
Compiling hal_lld.c
Compiling hal_efl_lld.c
Compiling stm32_dma.c
Compiling stm32_exti.c
Compiling hal_pal_lld.c
Compiling hal_st_lld.c
Compiling hal_serial_lld.c
Compiling board.c
Compiling osal.c
Compiling chsys.c
Compiling chrfcu.c
Compiling chdebug.c
Compiling chtrace.c
Compiling chvt.c
Compiling chschd.c
Compiling chinstances.c
Compiling chthreads.c
Compiling chregistry.c
Compiling chsem.c
Compiling chmtx.c
Compiling chcond.c
Compiling chevents.c
Compiling chmsg.c
Compiling chdynamic.c
Compiling chmboxes.c
Compiling chmemcore.c
Compiling chmemheaps.c
Compiling chmempools.c
Compiling chpipes.c
Compiling chobjcaches.c
Compiling chdelegates.c
Compiling chfactory.c
Compiling chcore.c
Compiling ch_test.c
Compiling ch_test_printf.c
Compiling rt_test_root.c
Compiling rt_test_sequence_001.c
Compiling rt_test_sequence_002.c
Compiling rt_test_sequence_003.c
Compiling rt_test_sequence_004.c
Compiling rt_test_sequence_005.c
Compiling rt_test_sequence_006.c
Compiling rt_test_sequence_007.c
Compiling rt_test_sequence_008.c
Compiling rt_test_sequence_009.c
Compiling rt_test_sequence_010.c
Compiling rt_test_sequence_011.c
Compiling rt_test_sequence_012.c
Compiling oslib_test_root.c
Compiling oslib_test_sequence_001.c
Compiling oslib_test_sequence_002.c
Compiling oslib_test_sequence_003.c
Compiling oslib_test_sequence_004.c
Compiling oslib_test_sequence_005.c
Compiling oslib_test_sequence_006.c
Compiling oslib_test_sequence_007.c
Compiling oslib_test_sequence_008.c
Compiling oslib_test_sequence_009.c
Compiling main.c
Linking build/ch.elf
lto-wrapper: warning: Options to '-Xassembler' do not match: -alms=./build/lst/crt1.lst, -alms=./build/lst/hal.lst, dropping all '-Xassembler' and '-Wa' options.
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more information
Creating build/ch.hex
Creating build/ch.bin
Creating build/ch.dmp
text data bss dec hex filename
59312 260 147192 206764 327ac build/ch.elf
Creating build/ch.list
Done[/spoil]
If you make the further changes:
#define HAL_USE_PWM TRUE
and
#define STM32_GPT_USE_TIM3 TRUE
#define STM32_GPT_USE_TIM4 TRUE
then it fails with
[spoil]egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before #
Compiling hal.c
Compiling hal_st.c
Compiling hal_buffered_serial.c
Compiling hal_buffers.c
Compiling hal_queues.c
Compiling hal_flash.c
Compiling hal_mmcsd.c
Compiling hal_pal.c
Compiling hal_pwm.c
Compiling hal_serial.c
Compiling nvic.c
Compiling stm32_isr.c
In file included from /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/STM32G0xx/stm32_isr.c:87:
/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/TIMv1/stm32_tim3_4.inc: In function 'tim3_tim4_irq_init':
/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/TIMv1/stm32_tim3_4.inc:108:20: error: 'STM32_IRQ_TIM3_TIM4_PRIORITY' undeclared (first use in this function); did you mean 'STM32_IRQ_TIM3_4_PRIORITY'?
108 | STM32_IRQ_TIM3_TIM4_PRIORITY);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| STM32_IRQ_TIM3_4_PRIORITY
/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/hal/ports/STM32/LLD/TIMv1/stm32_tim3_4.inc:108:20: note: each undeclared identifier is reported only once for each function it appears in
make: *** [/home/charlesrwest/cpp/libraries/ChibiOS_21.11.3//os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:190: build/obj/stm32_isr.o] Error 1[/spoil]
Those being the only differences confirmed by recursive diff:
[spoil]diff -r ./ /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3/demos/STM32/RT-STM32G0B1RE-NUCLEO64/
diff -r ./cfg/halconf.h /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3/demos/STM32/RT-STM32G0B1RE-NUCLEO64/cfg/halconf.h
124c124
< #define HAL_USE_PWM TRUE
---
> #define HAL_USE_PWM FALSE
diff -r ./cfg/mcuconf.h /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3/demos/STM32/RT-STM32G0B1RE-NUCLEO64/cfg/mcuconf.h
195,196c195,196
< #define STM32_PWM_USE_TIM3 TRUE
< #define STM32_PWM_USE_TIM4 TRUE
---
> #define STM32_PWM_USE_TIM3 FALSE
> #define STM32_PWM_USE_TIM4 FALSE
diff -r ./Makefile /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3/demos/STM32/RT-STM32G0B1RE-NUCLEO64/Makefile
92c92
< CHIBIOS := /home/charlesrwest/cpp/libraries/ChibiOS_21.11.3/
---
> CHIBIOS := ../../..[/spoil]
I have also attached the project. Thanks.
Re: Support for STM32G0B1
Posted: Wed Nov 08, 2023 9:36 am
by Giovanni
Hi,
Fixed in repository trunk.
Giovanni
Re: Support for STM32G0B1
Posted: Thu Nov 09, 2023 3:48 pm
by charlesrwest
Thank you. I have verified that the TIM3, TIM4 PWM channels are working as expected on my board.
I cannot reproduce the PF3-4 PAL_MODE_INPUT_PULLUP causing crash bug in an isolated example based on the example in the trunk, so it was probably a mess up on my side (apologies). I will keep digging.
Thanks again. This really helps.