cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750 Copy to ITCM without GCC "Copy to NULL" warning

Will5
Visitor

I see lots of posts with folk struggling to get code into ITCM, but not the (sorta) problem I have after getting things working.  It is just a compiler warning, but I'd like to find an elegant way of handling it.

The issue is I am using memcpy to copy my code intended for the ITCM from external flash to ITCM space.  All is good and it works, but since the start of ITCM is at address 0, GCC understandably questions my intentions as I'm doing a memcpy to NULL!  It's just a warning I've been living with, but I'm in a clean-up phase and would like to clear this warning.

 

Options I've considered but none seem a clean solution:

1) Use -Wnonnull option: Would work, but the warning overall is a good one and not a good idea to disable for the entire project.  There might be some way to disable it just for the file making the call, but still--ick.

2) Manually copy the first 4 bytes (or something like that) and then use memcpy for addresses 4+.  This seems the least ugly, but still...

3) Use a hardware DMA.  I presume this would work.  Speed isn't an issue and I'd still just be waiting for the DMA to finish before continuing.  Seems an overly complicated way to avoid a compiler warning.

 

What have other folk done?  I'm certainly not the first one trying to solve this issue and it isn't even unique to the H750.

will

0 REPLIES 0