Architecture specific functionality for the ELF loader.
[ELF object code loader]
Detailed Description
The architecture specific functionality for the Contiki ELF loader has to be implemented for each processor type Contiki runs on.
Since the ELF format is slightly different for different processor types, the Contiki ELF loader is divided into two parts: the generic ELF loader module (ELF object code loader) and the architecture specific part (this module). The architecture specific part deals with memory allocation, code and data relocation, and writing the relocated ELF code into program memory.
To port the Contiki ELF loader to a new processor type, this module has to be implemented for the new processor type.
Function Documentation
void* elfloader_arch_allocate_ram |
( |
int |
size |
) |
|
|
|
Allocate RAM for a new module.
- Parameters:
-
| size | The size of the requested memory. |
- Returns:
- A pointer to the allocated RAM
This function is called from the Contiki ELF loader to allocate RAM for the module to be loaded into. |
void* elfloader_arch_allocate_rom |
( |
int |
size |
) |
|
|
|
Allocate program memory for a new module.
- Parameters:
-
| size | The size of the requested memory. |
- Returns:
- A pointer to the allocated program memory
This function is called from the Contiki ELF loader to allocate program memory (typically ROM) for the module to be loaded into. |
void elfloader_arch_relocate |
( |
int |
fd, |
|
|
unsigned int |
sectionoffset, |
|
|
struct elf32_rela * |
rela, |
|
|
char * |
addr |
|
) |
|
|
|
Perform a relocation.
- Parameters:
-
| fd | The file descriptor for the ELF file. |
| sectionoffset | The file offset at which the relocation can be found. |
| rela | A pointer to an ELF32 rela structure (struct elf32_rela). |
| addr | The relocated address. |
This function is called from the Contiki ELF loader to perform a relocation on a piece of code or data. The relocated address is calculated by the Contiki ELF loader, based on information in the ELF file, and it is the responsibility of this function to patch the executable code. The Contiki ELF loader passes a pointer to an ELF32 rela structure (struct elf32_rela) that contains information about how to patch the code. This information is different from processor to processor. |
void elfloader_arch_write_text |
( |
int |
fd, |
|
|
unsigned int |
size, |
|
|
char * |
mem |
|
) |
|
|
|
Write the program code (text segment) into program memory.
- Parameters:
-
| fd | The file descriptor for the ELF file. |
| size | The size of the text segment. |
| mem | A pointer to the where the text segment should be flashed |
This function is called from the Contiki ELF loader to write the program code (text segment) of a loaded module into memory. The function is called when all relocations have been performed. |
Generated on Thu Jun 22 17:45:43 2006 for Contiki 2.x by
1.4.4