Compile error with CubeMX import

Sysprogs forums Forums VisualGDB Compile error with CubeMX import

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11002
    Dubbie
    Participant

    Hi,

    I have followed the tutorial successfully with an STM32F0 project and everything worked fine.

    Now I am starting a STM32F4 project and can’t get a blank new project to compile.

    Once again I have followed the tutorial exactly.

    Here is my error:

    1>------ Build started: Project: NEC_Decode4, Configuration: Debug Win32 ------
    1> VisualGDB: Run "cmd.exe /c "C:\SysGCC\arm-eabi\bin\make.exe" CONFIG=Debug -j12" in directory "C:\Dev\Embedded\STM32F4\NEC_Decode4\NEC_Decode4" on local computer
    1> C:\SysGCC\arm-eabi/bin/arm-eabi-gcc.exe -ggdb -ffunction-sections -O0 -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -I../Inc -IC:/Users/Rhys/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F4xxxx/CMSIS_HAL/Device/ST/STM32F4xx/Include -IC:/Users/Rhys/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F4xxxx/STM32F4xx_HAL_Driver/Inc -I. -IC:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/STM32F4xx_HAL_Driver/Inc -IC:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/STM32F4xx_HAL_Driver/Inc/Legacy -IC:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/CMSIS_HAL/Device/ST/STM32F4xx/Include -IC:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/CMSIS_HAL/Include -DDEBUG=1 -DARM_MATH_CM4 -DSTM32F407VG -Dflash_layout -DSTM32F407xx -c C:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c -o Debug/stm32f4xx_hal_rcc.o -MD -MF Debug/stm32f4xx_hal_rcc.dep
    1> Debug/stm32f4xx_hal_rcc.o: In function `HAL_RCC_GetPCLK1Freq':
    1>C:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32F4xxxx\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c(939): error : undefined reference to `APBPrescTable'
    1> Debug/stm32f4xx_hal_rcc.o: In function `HAL_RCC_GetPCLK2Freq':
    1>C:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32F4xxxx\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c(951): error : undefined reference to `APBPrescTable'
    1>collect2.exe : error : ld returned 1 exit status
    1> make: *** [Debug/NEC_Decode4.elf] Error 1
    1> C:\SysGCC\arm-eabi/bin/arm-eabi-g++.exe -o Debug/NEC_Decode4.elf -Wl,-gc-sections --specs=nano.specs -TC:\Users\Rhys\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32/STM32F4xxxx/LinkerScripts/STM32F407VG_flash.lds -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Wl,--start-group Debug/startup_stm32f407xx.o Debug/stm32f4xx_hal.o Debug/stm32f4xx_hal_adc.o Debug/stm32f4xx_hal_adc_ex.o Debug/stm32f4xx_hal_can.o Debug/stm32f4xx_hal_cec.o Debug/stm32f4xx_hal_cortex.o Debug/stm32f4xx_hal_crc.o Debug/stm32f4xx_hal_cryp.o Debug/stm32f4xx_hal_cryp_ex.o Debug/stm32f4xx_hal_dac.o Debug/stm32f4xx_hal_dac_ex.o Debug/stm32f4xx_hal_dcmi.o Debug/stm32f4xx_hal_dcmi_ex.o Debug/stm32f4xx_hal_dfsdm.o Debug/stm32f4xx_hal_dma.o Debug/stm32f4xx_hal_dma2d.o Debug/stm32f4xx_hal_dma_ex.o Debug/stm32f4xx_hal_dsi.o Debug/stm32f4xx_hal_eth.o Debug/stm32f4xx_hal_flash.o Debug/stm32f4xx_hal_flash_ex.o Debug/stm32f4xx_hal_flash_ramfunc.o Debug/stm32f4xx_hal_fmpi2c.o Debug/stm32f4xx_hal_fmpi2c_ex.o Debug/stm32f4xx_hal_gpio.o Debug/stm32f4xx_hal_hash.o Debug/stm32f4xx_hal_hash_ex.o Debug/stm32f4xx_hal_hcd.o Debug/stm32f4xx_hal_i2c.o Debug/stm32f4xx_hal_i2c_ex.o Debug/stm32f4xx_hal_i2s.o Debug/stm32f4xx_hal_i2s_ex.o Debug/stm32f4xx_hal_irda.o Debug/stm32f4xx_hal_iwdg.o Debug/stm32f4xx_hal_lptim.o Debug/stm32f4xx_hal_ltdc.o Debug/stm32f4xx_hal_ltdc_ex.o Debug/stm32f4xx_hal_mmc.o Debug/stm32f4xx_hal_nand.o Debug/stm32f4xx_hal_nor.o Debug/stm32f4xx_hal_pccard.o Debug/stm32f4xx_hal_pcd.o Debug/stm32f4xx_hal_pcd_ex.o Debug/stm32f4xx_hal_pwr.o Debug/stm32f4xx_hal_pwr_ex.o Debug/stm32f4xx_hal_qspi.o Debug/stm32f4xx_hal_rcc.o Debug/stm32f4xx_hal_rcc_ex.o Debug/stm32f4xx_hal_rng.o Debug/stm32f4xx_hal_rtc.o Debug/stm32f4xx_hal_rtc_ex.o Debug/stm32f4xx_hal_sai.o Debug/stm32f4xx_hal_sai_ex.o Debug/stm32f4xx_hal_sd.o Debug/stm32f4xx_hal_sdram.o Debug/stm32f4xx_hal_smartcard.o Debug/stm32f4xx_hal_spdifrx.o Debug/stm32f4xx_hal_spi.o Debug/stm32f4xx_hal_sram.o Debug/stm32f4xx_hal_tim.o Debug/stm32f4xx_hal_tim_ex.o Debug/stm32f4xx_hal_uart.o Debug/stm32f4xx_hal_usart.o Debug/stm32f4xx_hal_wwdg.o Debug/stm32f4xx_ll_adc.o Debug/stm32f4xx_ll_crc.o Debug/stm32f4xx_ll_dac.o Debug/stm32f4xx_ll_dma.o Debug/stm32f4xx_ll_dma2d.o Debug/stm32f4xx_ll_exti.o Debug/stm32f4xx_ll_fmc.o Debug/stm32f4xx_ll_fsmc.o Debug/stm32f4xx_ll_gpio.o Debug/stm32f4xx_ll_i2c.o Debug/stm32f4xx_ll_lptim.o Debug/stm32f4xx_ll_pwr.o Debug/stm32f4xx_ll_rcc.o Debug/stm32f4xx_ll_rng.o Debug/stm32f4xx_ll_rtc.o Debug/stm32f4xx_ll_sdmmc.o Debug/stm32f4xx_ll_spi.o Debug/stm32f4xx_ll_tim.o Debug/stm32f4xx_ll_usart.o Debug/stm32f4xx_ll_usb.o Debug/stm32f4xx_ll_utils.o Debug/main.o Debug/stm32f4xx_hal_msp.o Debug/stm32f4xx_it.o Debug/system_stm32f4xx.o -Wl,--end-group
    1> -------------------------------------------------------------
    1> Command exited with code 2
    1> Executable: cmd.exe
    1> Arguments: /c "C:\SysGCC\arm-eabi\bin\make.exe" CONFIG=Debug -j12
    1> Directory: C:\Dev\Embedded\STM32F4\NEC_Decode4\NEC_Decode4
    1>VisualGDB : error : Command-line action failed
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDB.exe" /build "C:\Dev\Embedded\STM32F4\NEC_Decode4\NEC_Decode4\NEC_Decode4.vcxproj" "/solution:C:\Dev\Embedded\STM32F4\NEC_Decode4\NEC_Decode4\NEC_Decode4.sln" "/config:Debug" "/platform:Win32"" exited with code 1.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I am not sure where I am going wrong. If I click the error, Intellisense happily sees the definition of `APBPrescTable’ without any trouble, so I’m not really sure what I can change to make it work.

    My visualGDB makefile include paths are as follows:

    View post on imgur.com

    Thanks for any hints you can throw my way,

    R

    • This topic was modified 7 years, 7 months ago by Dubbie.
    • This topic was modified 7 years, 7 months ago by Dubbie.
    #11012
    support
    Keymaster

    Hi,

    Please double-check that your project includes a system_stm32xxxx.c file. It should either come from the code generated by STM32CubeMX or from the VisualGDB BSP directory (enabled by referencing ‘default system file’ framework on the Embedded Frameworks page of VisualGDB Project Properties).

    #11019
    Dubbie
    Participant

    It does include a system_stm32xxx.c file. However, I just realised that in that file, the definition for AHBPrescTable[16] is present, but there is nothing for APBPrescTable[8].

    No idea why this is the case.
    I added a new line:

    const uint8_t APBPrescTable[8] = { 0, 0, 0, 0, 1, 2, 3, 4 };

    And now it seems to build fine.
    Thankyou for pointing me in the right direction.

    R

    #11022
    support
    Keymaster

    Hi,

    If you had to add a line manually, there could be a version mismatch between your system file and the HAL library and that could cause further cryptic errors. We would strongly encourage double-checking this and getting the correct version rather than just adding a missing line, as it would help avoid really tough-to-pinpoint problems.

    #20081
    krish_iyer
    Participant

    This fix worked for me too @Dubbie

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.