Hello,
I'am using Eclipse with ARM-GCC. For my controller (MAC7111) I have to
implemend a struct at a fixed adres of 0x400 to prevent the FLASH from
beeing secured.
With the code below I get the security at the right adres but not the
start-up code etc at adres 0x0.
What I want is the start-up code at adres 0x0 and the rest of the code
starting at adres 0x500.
Does anyone known how to adjust the linker script to get this done?
Thnx for your help!
Struct looks like :
struct FLash_Configuration_Field
{
unsigned long Backdoor_Comparison_Key 1;
unsigned long Backdoor_Comparison_Key 2;
unsigned long Program_Flash_Protection_Bytes ;
unsigned long Program_Flash_SUPV_Access_Bytes ;
unsigned long Program_Flash_DATA_Access_Bytes ;
unsigned long Flash_Security_Word ;
unsigned char Data_Flash_Protection_Byte ;
unsigned char Data_Flash_SUPV_Access_Byte ;
unsigned char Data_Flash_DATA_Access_Byte ;
} ;
_attribute_ ((section(".security")))
const struct FLash_Configuration_Field MyConfig =
{
0xABABABAB, // Backdoor_Comparison_Key 1
0xABABABAB, // Backdoor_Comparison_Key 2
0x00000000, // Program_Flash_Protection_Bytes
0x00000000, // Program_Flash_SUPV_Access_Bytes
0xFFFFFFFF, // Program_Flash_DATA_Access_Bytes
0x80000002, // Flash_Security_Word
0x00, // Data_Flash_Protection_Byte
0xFF, // Data_Flash_SUPV_Access_Byte
0x00 // Data_Flash_DATA_Access_Byte
} ;
I've created a extra entry in the linker file like:
MEMORY
{
rom : org = 0x00000000, len = 512k
rom_start : org = 0x00000400, len = 2k
}
/*
* Do not change the next code
*/
SECTIONS
{
.text :
{
*(.security);
. = ALIGN(4);
} > rom_start
.text :
{
*(.vectors);
. = ALIGN(4);
*(.init);
. = ALIGN(4);
*(.text);
. = ALIGN(4);
*(.rodata);
. = ALIGN(4);
*(.rodata*);
. = ALIGN(4);
*(.glue_7t);
. = ALIGN(4);
*(.glue_7);
} > rom
.text :
{
. = ALIGN(4);
etext = .;
} > rom_start
.data :
{
PROVIDE (__data_start = .);
*(.data)
. = ALIGN(4);
edata = .;
_edata = .;
PROVIDE (__data_end = .);
} > rom
.bss :
{
PROVIDE (__bss_start = .);
*(.bss)
*(COMMON)
. = ALIGN(4);
PROVIDE (__bss_end = .);
. = ALIGN(256);
PROVIDE (__stack_start = .);
PROVIDE (__stack_fiq_start = .);
. += FIQ_STACK_SIZE;
. = ALIGN(4);
PROVIDE (__stack_fiq_end = .);
PROVIDE (__stack_irq_start = .);
. += IRQ_STACK_SIZE;
. = ALIGN(4);
PROVIDE (__stack_irq_end = .);
PROVIDE (__stack_abt_start = .);
. += ABT_STACK_SIZE;
. = ALIGN(4);
PROVIDE (__stack_abt_end = .);
PROVIDE (__stack_und_start = .);
. += UND_STACK_SIZE;
. = ALIGN(4);
PROVIDE (__stack_und_end = .);
PROVIDE (__stack_svc_start = .);
. += SVC_STACK_SIZE;
. = ALIGN(4);
PROVIDE (__stack_svc_end = .);
PROVIDE (__stack_end = .);
PROVIDE (__heap_start = .);
} > rom
}
/*** EOF ***/
Elwin V. wrote:
> No one who can help me?
You can do something like this
/* first section is .armVector which is used for the start up assembly
file */
.vector :
{
*SAM7A3Assembly.o (.vector) /* Required Assembly file */
FILL(0xff);
. = ALIGN(256); /* Align to the end of the page */
*(.vector .vector.*) /* Do the remaining vector stuff (its teh
init.c file) */
} > ROM
.security :
{ *(.security .security .*) /* remaining os code */
} > ROM
. = ALIGN(4);
/* third section is .text which is used for code */
.text :
{
/* text stuff goes here */
} > ROM
Then in the makefile add:
LDFLAGS += -Wl,--section-start=.security=0x400
LDFLAGS += -Wl,--section-start=.text=0x500
This should work in theory. This is pretty much a copy/paste from my
makefile, but we're also doing a lot of other voodoo magic here and I
may have missed/forgotten a step
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.