Not applicable
Jan 21, 2014
02:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 21, 2014
02:07 AM
If you would like to run all functions in one object file (eg. MyObject_SRAM.o) from PSRAM. You can make some changes in both startup file (eg. startup_XMC4500.s) and linker descript file (*.ld):
1) Exclude the object file which will be copied to PSRAM in *.ld by replacing
2) Define a new section in *.ld and list the copied object file before "/*Heap - Bank1*/"
3) Add a copy process in startup_XMC4500.s before "SKIPSRAMCODECOPY:"
1) Exclude the object file which will be copied to PSRAM in *.ld by replacing
*(.text .text.* .gnu.linkonce.t.*);with
/* exclude the object file that will run from PSRAM from Flash */
*(EXCLUDE_FILE( *MyObject_SRAM.o) *text* )
*(.gnu.linkonce.t.*);
2) Define a new section in *.ld and list the copied object file before "/*Heap - Bank1*/"
/*=== SRAMCode section for PSRAM code ============*/
SRAMCodeLoad = eROData + __Xmc4500_Data_Size;
SRAMCode_Section : AT (SRAMCodeLoad)
{
SRAMCodeStart = ABSOLUTE(.);
/* list the object files running from PSRAM here*/
*MyObject_SRAM.o(*text*);
. = ALIGN(4);
SRAMCodeEnd = ABSOLUTE(.);
} > PSRAM_1
SRAMCodeSize = SRAMCodeEnd - SRAMCodeStart;
3) Add a copy process in startup_XMC4500.s before "SKIPSRAMCODECOPY:"
/*========== SRAM code copy ===========================*/
SKIPDATACOPY:
/* R0 = Start address, R1 = Destination address, R2 = Size */
LDR R0, =SRAMCodeLoad
LDR R1, =SRAMCodeStart
LDR R2, =SRAMCodeSize
/* Is there anything to be copied? */
CMP R2,#0
BEQ SKIPSRAMCODECOPY
/* For bytecount less than 4, at least 1 word must be copied */
CMP R2,#4
BCS STARTSRAMCODECOPY
/* Byte count < 4 ; so bump it up */
MOV R2,#4
STARTSRAMCODECOPY:
/*
R2 contains byte count. Change it to word count. It is ensured in the
linker script that the length is always word aligned.
*/
LSR R2,R2,#2 /* Divide by 4 to obtain word count */
/* The proverbial loop from the schooldays */
SRAMCODECOPYLOOP:
LDR R3,[R0]
STR R3,[R1]
SUBS R2,#1
BEQ SKIPSRAMCODECOPY
ADD R0,#4
ADD R1,#4
B SRAMCODECOPYLOOP
/*=================== end of Copy process =================*/
3 Replies
Not applicable
May 27, 2014
07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 27, 2014
07:12 AM
Sophia,
isn't it possible to post a complete small project with one or two functions executed in RAM?
This could more easily used as a template for such kind of projects.
Regards
Heinz
isn't it possible to post a complete small project with one or two functions executed in RAM?
This could more easily used as a template for such kind of projects.
Regards
Heinz
Not applicable
Jun 13, 2014
09:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 13, 2014
09:59 AM
Yes, that would be very helpfull.
Attachments are accessible only for community members.
Not applicable
Jun 16, 2014
02:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 16, 2014
02:05 AM