Hello
The lines
.userram : {} > userram
.code : {} > code
.vectorram : {} > vectorram
.vectorrom : {} > vectorrom
Indicates that you are placing the section .userram from your application in the memory area userram, section .code into memory area code, section .vectorram in memory area vectorram and section vectorrom in section vectorrom.
If you are sure these sections are not used at all in your application, you can remove the lines from the .lcf file.
I would try to link the application as it is and check the generated .map file to make sure the sections really do not exist in your final application.
CrasyCat
My issue is that I would like to load my application into flash at a specific address (my goal: eventually download a 2nd application to yet some other flash location, and when the system is reset, execute using this newly downloaded application).
In my .lcf link control file, I specify:
MEMORY {
vectorrom (RX) : ORIGIN = 0x00002000, LENGTH = 0x00000400
cfmprotrom (RX) : ORIGIN = 0x00002400, LENGTH = 0x00000020
code (RX) : ORIGIN = 0x00002A00, LENGTH = 0x0003FB00
vectorram (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000400
userram (RWX) : ORIGIN = 0x20000400, LENGTH = 0x00007C00
}
This will load and launch my application in flash from 0x2A00. The vector table is located in 0x2000 which I verify via the debugger, data is valid. But the system crashes ("Exception name vector: Address Error") if I "Run" it or attempt to step through the _startup entry routine.
If vectorrom is not at 0x00000000 then the system crashes - always. If the vectorrom is at the ZERO address, the system runs fine, entering the "code" as per its specification in the MEMORY section. So I can run code from anywhere in flash. But I need to have the vector table in flash also at a specific location in flash.
Any help to get me past this problem would be greatly appreciated.
Seems like you're using an MCU
flashbar always always starts at zero after each reset, then will start to look for vector table at zero.
you're lucky to start debugging code since you're using the debugger, which fixes these values using cfg file. you will not be able to see anything in standalone mode
you can change flashbar at runtime, not at the beggining
in my opinion, i don't think it's necessary to change flashbar even at runtime, seems more useful for MPUs with external memory
have you seen the first two longwords at vector table? those point to starting address and SP initial value
does this make sense to you or i completely misunderstood your question?
Actually, it makes perfect sense. Not good sense, but perfect. In fact, it was only after I posted that I was reading the ColdFire MCF52259_CMRM reference manual, where in section "3.2.6 Vector Base Register (VBR)" it states:
Well, I have 512K of flash. So the vector table *MUST* reside at address 0x0, so it cannot be moved elsewhere.
Now that I understand this aspect more clearly, I have to consider other alternative solutions to reach my goal.