Hello.
I have array.
char const buff [31];
I want to locate dannyy an array at the given in-memory address.
m_graphics (RX) : ORIGIN = 0x0003CFF0, LENGTH = 0x00002010 .......... .graphicstable : { ........... } > m_graphics
Share an example of the solution of the similar task.
Share an example of the solution of the similar task.
Share an example of the solution of the similar task.
Solved! Go to Solution.
Hi Prof,
Please reference this very good blog: Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
I tested it with KDS_3.0 and KSDK_1.3 for the FRDM-K64F.
Attached is my project. The os_tasks.c and ProcessorExpert.ld linker script are the files I modified to test placing buffer into SRAM and also one into Flash.
Snippets from those files:
unsigned char __attribute__((section (".myBufSection"))) buf[128]="holy SRAM batman"; | //DES this is in SRAM....look at linker file too |
const unsigned char __attribute__((section (".myFlashBufSection"))) fbuf[128]="holy Flash batman"; | //DES this is in Flash....look at linker file too |
m_text_2 (RX) : ORIGIN = 0x000FFF00, LENGTH = 0x00000100
m_data_3 (RW) : ORIGIN = 0x20020000, LENGTH = 0x00010000
/* placing my named section at given address: */
.myBufBlock 0x20020000 :
{
KEEP(*(.myBufSection)) /* keep my variable even if not referenced */
} > m_data_3
.myFlashBufBlock 0x000FFF00 :
{
KEEP(*(.myFlashBufSection)) /* keep my variable even if not referenced */
} > m_text_2
Regards,
David
Hi Prof,
Please reference this very good blog: Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
I tested it with KDS_3.0 and KSDK_1.3 for the FRDM-K64F.
Attached is my project. The os_tasks.c and ProcessorExpert.ld linker script are the files I modified to test placing buffer into SRAM and also one into Flash.
Snippets from those files:
unsigned char __attribute__((section (".myBufSection"))) buf[128]="holy SRAM batman"; | //DES this is in SRAM....look at linker file too |
const unsigned char __attribute__((section (".myFlashBufSection"))) fbuf[128]="holy Flash batman"; | //DES this is in Flash....look at linker file too |
m_text_2 (RX) : ORIGIN = 0x000FFF00, LENGTH = 0x00000100
m_data_3 (RW) : ORIGIN = 0x20020000, LENGTH = 0x00010000
/* placing my named section at given address: */
.myBufBlock 0x20020000 :
{
KEEP(*(.myBufSection)) /* keep my variable even if not referenced */
} > m_data_3
.myFlashBufBlock 0x000FFF00 :
{
KEEP(*(.myFlashBufSection)) /* keep my variable even if not referenced */
} > m_text_2
Regards,
David
Hi, David E Seymour.
Thanks for the response.
You could prompt how to add my code?
.grap :
{
__LE_START = .;
WRITEW(0xFFFFFFFF);
WRITEW(0xFFFFFFFF);
WRITEW(0xFFFFFFFF);
WRITEW(0xFFFFFFFF);
. = __LE_START + 0x0010;
__CS_TABLE = .;
* (.grap)
} > m_graphics
I want to fill 16 bytes of xFF.
but Linker gives out an error.
Try
BYTE(expression)
SHORT(expression)
LONG(expression)
QUAD(expression)
By including one of these four statements in a section definition, you can explicitly place one, two, four, or eight bytes (respectively) at the current address of that section. QUAD is only supported when using a 64 bit host or target. Multiple-byte quantities are represented in whatever byte order is appropriate for the output file format From: http://www.math.utah.edu/docs/info/ld_3.html
Regards,
David
Sent from David Seymour's iPhone 6
Hi Prof,
I verified the above in attached linker script/file.
ProcessorExpeet.ld
.myFlashBufBlock 0x000FFF00 :
{
KEEP(*(.myFlashBufSection)) /* keep my variable even if not referenced */
LONG(0xdeadbeef)
SHORT(0xbeef)
SHORT(0xdead)
BYTE(0x10)
BYTE(0x20)
BYTE(0x03)
BYTE(0x04)
} > m_text_2
Memory Window
0x000FFEE8 ???????? ???????? ???????? ???????? ????????????????
0x000FFEF8 ???????? ???????? 796C6F68 616C4620 ????????holy Fla
0x000FFF08 62206873 616D7461 0000006E 00000000 sh batman.......
0x000FFF18 00000000 00000000 00000000 00000000 ................
0x000FFF28 00000000 00000000 00000000 00000000 ................
0x000FFF38 00000000 00000000 DEADBEEF DEADBEEF ........ï¾Þï¾Þ
0x000FFF48 04032010 FFFFFFFF ???????? . ..ÿÿÿÿ????
Regards,
David