Hi,
I am using WinARM GCC tools for compiling, linking the code for LPC2378.
This worked great until recently, where I need to put some signature in
LPC2378 at particular location to make it Code read protection.
Earlier my .ld file looks like
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-4k)
RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32)
}
and with LPC2378 requirement of putting the signature of 0x12345678 at
location 0x1FC I modified the .ld file as below
MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-4k)
RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32)
CRP_ROM (rx) : ORIGIN = 0x000001FC, LENGTH = 4
}
SECTIONS
{
/* place "myArray" inside "m_my_memory" */
.crpsection :
{
. = ALIGN(4);
KEEP(*(.crpsection*));
. = ALIGN(4);
} > CRP_ROM
/* first section is .text which is used for code */
.text :
{
/* *crt0.o (.text) */ /* Startup code */
/*KEEP (crp.o(.constdata))*/
KEEP(*(.vectorg))
KEEP(*(.RESET))
KEEP(*(.SWI_HANDLER))
. = ALIGN(4);
KEEP(*(.init)) /* Startup code from .init-section */
*(.text .text.*) /* remaining code */
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.gcc_except_table)
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.gnu.linkonce.r.*)
. = ALIGN(4);
} > ROM
/***** old:
.text :
{
*crt0.o (.text)
*(.text)
*(.rodata)
*(.rodata*)
*(.glue_7)
*(.glue_7t)
} > ROM
created a crp.c file with content
#define CRP1 0x12345678
__attribute__((section(".crpsection"))) unsigned int const
Security_Value = CRP1;
and added this makefile
SRC = $(TARGET).c monitor.c adc.c crp.c
With this I get an error saying
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
section .crpsection [000001fc -> 000001ff] overlaps section .text
[00000000 -> 0000b23b]
c:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe:
main.elf: section .crpsection lma 0x1fc overlaps previous sections
Basically I want to reserve memory location 0x1FC for CRP value. This is
basically putting a section inside a section.
Is it possible to do this way in WinARM - GCC tools sets? Or is there
any other way to do this? Generally I look at generated .bin file to see
the signature of 0x12345678 at location 0x1FC.
Any thoughts/ suggestions are helpful :)
With best regards,
Phani.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.