cancel
Showing results for 
Search instead for 
Did you mean: 

Issues in building projects created with CubeMX - Nucleo144-H7

Francesco Agosti
Associate II

Hello, I use CubeMX and System Workbench (SW4STM32). I generated a simple project for my board (N144 STM32H743ZI),using HAL drivers and managed to build it and debug it. I then started to play with the project, suddenly I noticed I could not debug anymore, even tho the build was finishing without errors.

I investigated and replicated the issue, simply by adding Cortex M7/DCache enabled in CubeMX. I don;'t think the issue is cache specific and found that what actually happens is that the elf file (which initially was created correctly) is now tiny and contains only two entries : _finit() and _init()

I tried on two different PCs, tried to load the hex with the stlink utility to no avail... apparently, a project that was building correctly, suddenly becomes "faulty", the build process terminates with no errors, the elf and hex are created, but they do not contain anymore what they were supposed to.

I tried using H7 firmware 1.3.2 and 1.3.0 : nothing changed.

Did anyone experience something similar and, maybe found a solution?

Thanks

Francesco

10 REPLIES 10

Typical reasons for losing the connection are entering low power modes, or reconfiguring the pins used by the debugger.

>> even tho the build was finishing without errors.

Ok, means there are no syntax errors, and no linker errors. Doesn't mean the code is workable.

Does it create an ELF file?

Does it download and verify properly?

Can you output any diagnostic information via the USART and ST-LINK VCP?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Francesco Agosti
Associate II

Hi Cive, thanks for your reply.

Initially I thought it was an issue with the connection, this is why I also tried witht he STLink utility, but then I saw the elf and hex files are very small.

They are indeed created (deleted them, they were recreated with a successfull build, no errors). If I try to debug them, the execution does not even start.

I am quite confident the problem is NOT with my code because I am replicating this issue with a trivial project (blink led) which gets messed up (not always!) once I regenerate the code from CubeMX.

I suspect there is something wrong with my toolchain as in both pcs I used I have other C / C++ tools (MinGW, CMake..), my toolchain configuration is the following :

Current Toolchain : Ac6 STM32 MCU GCC

Current Builder : Gnu Make Builder

The selecetd tools are the 6 MCU GCC / G++ tools

What I notices is that SOMETIMES I get a fail when I try to "Clean" a project, I retry again without changing anything, it works, but then I try to build and I get the error :

Src/subdir.mk:30: recipe for target 'Src/main.o' failed

.. which built jsut fine (= no errors, but created an elf that did not work) one minute before

I check in Debug\Src\subdir.mk and I find :

[....]

Src/%.o: ../Src/%.c

@echo 'Building file: $<'

[...]

the @echo line is marked as error in Eclipse (???)

At this point I am really scratching my head...

alister
Lead

Could the STM32CubeMX generate have damaged the link command file, e.g. it's lost the entry point and/or vector table?

Sorry ignore that, I didn't read your last post.

Francesco Agosti
Associate II

Uhm, it could be, but I had case of test projects going wrong, changing a few properties in Cube, generating them again and they were fine, to fail again at the next modification.

Also I am not 100% sure it depends from Cube, I think it happened also just doing modifications in Eclipse, even thos I was not able to replicate it yet.

And the fact that iot happens on both my machines makes me think it might be somewhat related to the other C tools I have installed... maybe the path for the make command is messed up aqnd points to something it should not... will try to clean up my environment variables

Francesco Agosti
Associate II

Well, this thin is weird, I even tried to remove MingW and Cmake from my path (should not matter, but at this point I am willing to try anything) ... nothing changed.

I still get a build message that shows a pretty much an empty elf

make --no-print-directory post-build 
Generating hex and Printing size information: 
arm-none-eabi-objcopy -O ihex "t1.elf" "t1.hex" 
arm-none-eabi-size "t1.elf" 
  text	  data	  bss	  dec	  hex	filename 
   8	   0	   0	   8	   8	t1.elf

Francesco Agosti
Associate II

... and my flash.LD file is empty as reported in this other post, someone else having the same issue apparently

https://community.st.com/s/question/0D50X0000Aea4HJSQY/cubemx-510-regenerated-project-for-sw4stm32-linker-script-ld-file-is-empty

Khouloud GARSI
Lead II

Hello,

This is reported internally to our CubeMX team for further check and we will keep you posted about any further update regarding this request.

Sorry for any inconvenience this may have brought.

Khouloud.

Hi @Francesco Agosti​ 

I did the same scenario and i did not have a problem. Could you please send me your .ioc file to check the problem ?

Best regards.

Nesrine