Skip to main content
Associate III
Apr 12, 2024 11:48 AM UTC
Question

Copy Data from Rom to Ram

how to copy  sdata from rom to ram in stm32f407 board.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
Apr 12, 2024 11:53 AM UTC

Use memcpy() ?

Check startup_f4xx.s for code that copies statics and Linker scripts for symbols.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Associate III
Apr 12, 2024 12:05 PM UTC

I develop my Mcu driver code for stm32fdiscovery board by using two functions Mcu_Init and Mcu_InitClock.

But when I try to flash my code, I didn't get the values of register there .

Can you help me out with this.

Tesla DeLorean
Guru
Apr 12, 2024 3:50 PM UTC

Can you buy me coffee?

With the GNU/GCC model you typically use the linker script (.LD) to stage RAM data in ROM so at startup you can copy it. Code in the startup.s source file uses the symbols to determine the location and size of this data, and then has the assembler equivalent to memcpy() to move from the ROM staging area to the RAM destination.

Perhaps look at some of ST's supplied examples, and some college level texts on linkers, compilers, and embedded programming.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..