cancel
Showing results for 
Search instead for 
Did you mean: 

Keil + STM32 + ST-Link: Not loading a second memory section defined in scatter (linker) file

mikesutton
Associate
Posted on April 29, 2014 at 15:53

I'm using a STM32F103C8 + ST-LINK.

I have created a second memory section in the scatter file:

LR_IROM1 0x08000000 0x00010000 { ; load region size_region

ER_IROM1 0x08000000 0x00005000 { ; load address = execution address

*.o (RESET, +First)

.ANY (+RO)

}

MY_SECT 0x08005000 0x00000400 {

main.o

}

RW_IRAM1 0x20000000 0x00005000 { ; RW data

.ANY (+RW +ZI)

}

}

Everything compiles. Itlookslike the programmer loads to flash. However, when I execute code in the debugger, all memory in that new section is 0xFF -- I can see this in the memory viewer. The program starts executing code in the root section and then eventually jumps to code in the new section. When I start trying to execute code in that new region (MY_SECT), the program jumps to an exception handler.

Any suggestions? What else could I do to debug?

Thank you!

#stm32-keil

4 REPLIES 4
Posted on April 29, 2014 at 17:17

You could inspect the .MAP file and the .HEX file

You might also want to consider splitting the IROM into two rather than creating a load region within the first.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mikesutton
Associate
Posted on April 29, 2014 at 20:35

Thank you for the reply.

The .map file shows the section. I'm not entirely sure how to decode the .hex file. I did try creating a second memory section and that seems to work!! My scatter file now looks like:

LR_IROM1 0x08000000 0x000080000 { ; load region size_region
ER_IROM1 0x08000000 0x00008000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
}
LR_IROM1_2 0x08008000 0x00008000 {
MY_SECT 0x08008000 0x00008000 {
main.o
}
RW_IRAM1 0x20000000 0x00005000 { ; RW data
.ANY (+RW +ZI)
}
}

Thanks for the help!
yv
Associate
Posted on July 31, 2015 at 07:27

I have 2 devices each with their own code and bootloader. I am using STM32F4 discovery boards.

Both these boards communicate with each other throudh I2C. I want to add the binary of one project code into another so that i can update the firmware of one device from another. How can i do that?? Help me out. Thanks in advance

Posted on July 31, 2015 at 17:49

This seems woefully off-topic, next time consider if your question is on point or not, and start a new thread when it's not.

You have a couple of options.

The .HEX file is a reasonably simple format. You could process and manipulate your two firmware images and create an output that can be programmed by regular part programming tools.

The .BIN files could be manipulated and packaged using C's stdio functions, ie fopen/fclose/fseek/fread/fwrite.

You could take your secondary binary image, and write a simple tool to process the image and output it as a standard C array, in ASCII, which you can then #include into your primary application build.

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