35 #include "dev/flash.h"
37 static uint16_t datamemory_aligned[ELFLOADER_DATAMEMORY_SIZE/2+1];
38 static uint8_t* datamemory = (uint8_t *)datamemory_aligned;
39 #if ELFLOADER_CONF_TEXT_IN_ROM
40 static const char textmemory[ELFLOADER_TEXTMEMORY_SIZE] = {0};
42 static char textmemory[ELFLOADER_TEXTMEMORY_SIZE];
54 #if ELFLOADER_CONF_TEXT_IN_ROM
57 ((
unsigned long)&textmemory[0] & 0xfffffe00) +
58 (((
unsigned long)&textmemory[0] & 0x1ff) == 0? 0: 0x200);
68 #if ELFLOADER_CONF_TEXT_IN_ROM
71 unsigned short *flashptr;
75 flashptr = (
unsigned short *)mem;
78 for(ptr = 0; ptr < size; ptr += READSIZE) {
81 cfs_read(fd, (
unsigned char *)datamemory, READSIZE);
84 if((((
unsigned short)flashptr) & 0x01ff) == 0) {
93 for(i = 0; i < READSIZE / 2; ++i) {
94 flash_write(flashptr, ((
unsigned short *)datamemory)[i]);
102 cfs_read(fd, (
unsigned char *)mem, size);
109 struct elf32_rela *rela,
char *addr)
111 addr += rela->r_addend;
114 cfs_write(fd, (
char *)&addr, 2);