mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-12 10:30:09 +00:00
elfloader executing loaded programs from ram (not rom) by default on msp430 platforms.
This commit is contained in:
parent
c3b6ff6bd3
commit
5f3c1a0e12
@ -28,14 +28,18 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: elfloader-msp430.c,v 1.2 2006/12/18 14:54:04 fros4943 Exp $
|
||||
* @(#)$Id: elfloader-msp430.c,v 1.3 2009/01/15 09:04:55 fros4943 Exp $
|
||||
*/
|
||||
#include "elfloader-arch.h"
|
||||
|
||||
#include "dev/flash.h"
|
||||
|
||||
static char datamemory[ELFLOADER_DATAMEMORY_SIZE];
|
||||
#if ELFLOADER_CONF_TEXT_IN_ROM
|
||||
static const char textmemory[ELFLOADER_TEXTMEMORY_SIZE] = {0};
|
||||
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
static char textmemory[ELFLOADER_TEXTMEMORY_SIZE];
|
||||
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void *
|
||||
elfloader_arch_allocate_ram(int size)
|
||||
@ -46,16 +50,21 @@ elfloader_arch_allocate_ram(int size)
|
||||
void *
|
||||
elfloader_arch_allocate_rom(int size)
|
||||
{
|
||||
#if ELFLOADER_CONF_TEXT_IN_ROM
|
||||
/* Return an 512-byte aligned pointer. */
|
||||
return (char *)
|
||||
((unsigned long)&textmemory[0] & 0xfffffe00) +
|
||||
(((unsigned long)&textmemory[0] & 0x1ff) == 0? 0: 0x200);
|
||||
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
return textmemory;
|
||||
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define READSIZE 32
|
||||
void
|
||||
elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char *mem)
|
||||
{
|
||||
#if ELFLOADER_CONF_TEXT_IN_ROM
|
||||
int i;
|
||||
unsigned int ptr;
|
||||
unsigned short *flashptr;
|
||||
@ -87,6 +96,10 @@ elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char
|
||||
}
|
||||
|
||||
flash_done();
|
||||
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
cfs_seek(fd, textoff);
|
||||
cfs_read(fd, (unsigned char *)mem, size);
|
||||
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- C -*- */
|
||||
/* @(#)$Id: contiki-conf.h,v 1.31 2008/11/06 20:45:06 nvt-se Exp $ */
|
||||
/* @(#)$Id: contiki-conf.h,v 1.32 2009/01/15 09:04:04 fros4943 Exp $ */
|
||||
|
||||
#ifndef CONTIKI_CONF_H
|
||||
#define CONTIKI_CONF_H
|
||||
@ -22,6 +22,7 @@
|
||||
#define RF_CHANNEL 26
|
||||
#endif /* RF_CHANNEL */
|
||||
|
||||
#define ELFLOADER_CONF_TEXT_IN_ROM 0
|
||||
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x800
|
||||
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user