This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

embedded system ld script issues


I'm trying to write my own ld script for use in an embedded system, but I'm having a hard time with a couple of things. (I'm pretty much a newbie with ld)

First, what does the memory help (malloc, etc) need from the ld script?

Second, how can I define a memory map (where sections of code / data should go) in one place, to be used by source and in linkage? I have been using a .h header file which #defines several constants, but it seems that those aren't visible symbols in the ld script.

What I want to do is define a memory map of my flash part in one file and have the address and size of each section depend on the used flash part and be accessible both to source C code and for the linking process.

An example memory map:

#if FLASHTYPE_NEW
   #define FLASH_SIZE 0x00100000
   #define FLASH_SECTOR_SIZE 0x00001000
#endif
#if FLASHTYPE_OLD
   #define FLASH_SIZE 0x00040000
   #define FLASH_SECTOR_SIZE 0x00000800
#endif

/**************************************/
#define BOOT_ADDR   0x00000000
#define BOOT_SIZE   (BOOT_END-BOOT_ADDR)
#define BOOT_END    0x00004000
/**************************************/
#define EEPROM_ADDR BOOT_END
#define EEPROM_SIZE (2*FLASH_SECTOR_SIZE)
#define EEPROM_END  (EEPROM_ADDR+EEPROM_SIZE)
/**************************************/
#define CODE_ADDR   EEPROM_END
#define CODE_SIZE   (FLASH_SIZE-CODE_ADDR)
#define CODE_END    (CODE_ADDR+CODE_SIZE)
/**************************************/

--
Bryce Schober
Design Engineer
Dynon Avionics, Inc.
www.dynonavionics.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]