[cpu arm_common]
* added usb ram as heap3 * some feuerware merge adaptation [projects test_suite] * fixed some test scripts
This commit is contained in:
parent
e49a17f4f7
commit
55bb484b22
@ -14,6 +14,7 @@
|
|||||||
#include "bitarithm.h"
|
#include "bitarithm.h"
|
||||||
#include "hwtimer_cpu.h"
|
#include "hwtimer_cpu.h"
|
||||||
#include "hwtimer_arch.h"
|
#include "hwtimer_arch.h"
|
||||||
|
#include "irq.h"
|
||||||
|
|
||||||
#define VULP(x) ((volatile unsigned long*) (x))
|
#define VULP(x) ((volatile unsigned long*) (x))
|
||||||
|
|
||||||
|
|||||||
@ -31,9 +31,9 @@ and the mailinglist (subscription via web site)
|
|||||||
*
|
*
|
||||||
* @author Freie Universität Berlin, Computer Systems & Telematics, FeuerWhere project
|
* @author Freie Universität Berlin, Computer Systems & Telematics, FeuerWhere project
|
||||||
* @author Michael Baar <michael.baar@fu-berlin.de>
|
* @author Michael Baar <michael.baar@fu-berlin.de>
|
||||||
* @version $Revision: 3914 $
|
* @version $Revision$
|
||||||
*
|
*
|
||||||
* @note $Id: syscalls.c 3914 2012-02-14 09:31:06Z hwill $
|
* @note $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -45,16 +45,15 @@ and the mailinglist (subscription via web site)
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
// core
|
// core
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
// sys
|
#include "irq.h"
|
||||||
#include "lpm.h"
|
#include "io.h"
|
||||||
#include "tracelog.h"
|
|
||||||
#include "hal-syscalls.h"
|
|
||||||
|
|
||||||
/* When using the HAL standard in and out are handled by HAL
|
/* When using the HAL standard in and out are handled by HAL
|
||||||
devices. */
|
devices. */
|
||||||
#if FEUERWARE_CONF_ENABLE_HAL
|
#if FEUERWARE_CONF_ENABLE_HAL
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "interface-chardevice.h"
|
#include "interface-chardevice.h"
|
||||||
|
#include "hal-syscalls.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_SYSCALLS 0
|
#define DEBUG_SYSCALLS 0
|
||||||
@ -88,8 +87,7 @@ static caddr_t heap[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_star
|
|||||||
static const caddr_t heap_max[NUM_HEAPS] = {(caddr_t)&__heap1_max,(caddr_t)&__heap3_max,(caddr_t)&__heap2_max};
|
static const caddr_t heap_max[NUM_HEAPS] = {(caddr_t)&__heap1_max,(caddr_t)&__heap3_max,(caddr_t)&__heap2_max};
|
||||||
// start position in heap
|
// start position in heap
|
||||||
static const caddr_t heap_start[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start};
|
static const caddr_t heap_start[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start};
|
||||||
// current heap in use
|
|
||||||
volatile static uint8_t iUsedHeap = 0;
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -127,7 +125,7 @@ caddr_t _sbrk_r(struct _reent *r, size_t incr)
|
|||||||
uint32_t cpsr = disableIRQ();
|
uint32_t cpsr = disableIRQ();
|
||||||
|
|
||||||
/* check all heaps for a chunk of the requested size */
|
/* check all heaps for a chunk of the requested size */
|
||||||
for( ; iUsedHeap < NUM_HEAPS; iUsedHeap++ ) {
|
for(volatile uint8_t iUsedHeap = 0; iUsedHeap < NUM_HEAPS; iUsedHeap++ ) {
|
||||||
caddr_t new_heap = heap[iUsedHeap] + incr;
|
caddr_t new_heap = heap[iUsedHeap] + incr;
|
||||||
|
|
||||||
#ifdef MODULE_TRACELOG
|
#ifdef MODULE_TRACELOG
|
||||||
@ -151,7 +149,7 @@ caddr_t _sbrk_r(struct _reent *r, size_t incr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
r->_errno = ENOMEM;
|
r->_errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _isatty_r(struct _reent *r, int fd)
|
int _isatty_r(struct _reent *r, int fd)
|
||||||
@ -249,6 +247,9 @@ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count)
|
|||||||
#ifdef MODULE_FAT
|
#ifdef MODULE_FAT
|
||||||
result = ff_write_r(r, fd, data, count);
|
result = ff_write_r(r, fd, data, count);
|
||||||
#endif
|
#endif
|
||||||
|
PRINTF("write [%i] data @%p count %i\n", fd, data, count);
|
||||||
|
|
||||||
|
PRINTF("write [%i] returned %i errno %i\n", fd, result, r->_errno);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,27 +263,36 @@ int _read_r(struct _reent *r, int fd, void *buffer, unsigned int count)
|
|||||||
#ifdef MODULE_FAT
|
#ifdef MODULE_FAT
|
||||||
result = ff_read_r(r, fd, buffer, count);
|
result = ff_read_r(r, fd, buffer, count);
|
||||||
#endif
|
#endif
|
||||||
return result;
|
PRINTF("read [%i] buffer @%p count %i\n", fd, buffer, count);
|
||||||
|
PRINTF("read [%i] returned %i\n", fd, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _close_r(struct _reent *r, int fd)
|
int _close_r(struct _reent *r, int fd)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int result = -1;
|
||||||
r->_errno = EBADF;
|
r->_errno = EBADF;
|
||||||
#ifdef MODULE_FAT
|
#ifdef MODULE_FAT
|
||||||
ret = ff_close_r(r, fd);
|
ret = ff_close_r(r, fd);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
PRINTF("close [%i]\n", fd);
|
||||||
|
PRINTF("close returned %i errno %i\n", result, errno);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int _unlink_r(struct _reent *r, char* path)
|
int _unlink_r(struct _reent *r, char* path)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int result = -1;
|
||||||
r->_errno = ENODEV;
|
r->_errno = ENODEV;
|
||||||
#ifdef MODULE_FAT
|
#ifdef MODULE_FAT
|
||||||
ret = ff_unlink_r(r, path);
|
result = ff_unlink_r(r, path);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
PRINTF("unlink '%s'\n", path);
|
||||||
|
PRINTF("unlink returned %i errno %i\n", result, errno);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void _exit(int n)
|
void _exit(int n)
|
||||||
|
|||||||
@ -27,11 +27,11 @@ and the mailinglist (subscription via web site)
|
|||||||
/* specify the LPC2387 memory areas (see LPC2387 datasheet page 15) */
|
/* specify the LPC2387 memory areas (see LPC2387 datasheet page 15) */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
flash : ORIGIN = 0, LENGTH = 512K /* FLASH ROM */
|
flash : ORIGIN = 0, LENGTH = 504K /* FLASH ROM 512kByte without ISP bootloader*/
|
||||||
infomem : ORIGIN = 0x0007D000, LENGTH = 4K /* Last sector in FLASH ROM for config data */
|
infomem : ORIGIN = 0x0007D000, LENGTH = 4K /* Last sector in FLASH ROM for config data */
|
||||||
ram_battery : ORIGIN = 0xE0084000, LENGTH = 2K /* Battery RAM */
|
ram_battery : ORIGIN = 0xE0084000, LENGTH = 2K /* Battery RAM */
|
||||||
ram : ORIGIN = 0x40000000, LENGTH = 64K /* LOCAL ON-CHIP STATIC RAM */
|
ram : ORIGIN = 0x40000000, LENGTH = 64K /* LOCAL ON-CHIP STATIC RAM */
|
||||||
ram_usb : ORIGIN = 0x7FD00000, LENGTH = 16K /* USB RAM */
|
ram_usb : ORIGIN = 0x7FD00000, LENGTH = 16K /* USB RAM !!! first 1024 bytes are occupied from GPDMA for MCI */
|
||||||
ram_ethernet : ORIGIN = 0x7FE00000, LENGTH = 16K /* ethernet RAM */
|
ram_ethernet : ORIGIN = 0x7FE00000, LENGTH = 16K /* ethernet RAM */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +178,26 @@ SECTIONS
|
|||||||
} >ram /* put all the above into RAM (but load the LMA copy into FLASH) */
|
} >ram /* put all the above into RAM (but load the LMA copy into FLASH) */
|
||||||
. = ALIGN(4); /* ensure data is aligned so relocation can use 4-byte operations */
|
. = ALIGN(4); /* ensure data is aligned so relocation can use 4-byte operations */
|
||||||
_edata = .; /* define a global symbol marking the end of the .data section */
|
_edata = .; /* define a global symbol marking the end of the .data section */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exception frames (newer linker versions generate these but they use of
|
||||||
|
* most of the RAM.
|
||||||
|
*/
|
||||||
|
/DISCARD/ : /* discard exception frames */
|
||||||
|
{
|
||||||
|
*(.eh_*)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* to enable exception frames */
|
||||||
|
/*
|
||||||
|
.eh_frame :
|
||||||
|
{
|
||||||
|
KEEP (*(.eh_frame))
|
||||||
|
} > ram
|
||||||
|
. = ALIGN(4);
|
||||||
|
*/
|
||||||
|
|
||||||
_end = .; /* define a global symbol marking the end of application RAM */
|
_end = .; /* define a global symbol marking the end of application RAM */
|
||||||
|
|
||||||
__heap1_size = ORIGIN(ram) + LENGTH(ram) - . - __stack_size;
|
__heap1_size = ORIGIN(ram) + LENGTH(ram) - . - __stack_size;
|
||||||
@ -219,12 +239,23 @@ SECTIONS
|
|||||||
PROVIDE(__heap2_max = .); /* _heap shall always be < _heap_max */
|
PROVIDE(__heap2_max = .); /* _heap shall always be < _heap_max */
|
||||||
} > ram_ethernet
|
} > ram_ethernet
|
||||||
|
|
||||||
|
. = ORIGIN(ram_usb);
|
||||||
.usbdata (NOLOAD) : /* USB RAM section, may be used otherwise if USB is disabled */
|
.usbdata (NOLOAD) : /* USB RAM section, may be used otherwise if USB is disabled */
|
||||||
{
|
{
|
||||||
*(.usbdata)
|
*(.usbdata)
|
||||||
} > ram_usb
|
} > ram_usb
|
||||||
|
|
||||||
.batteryram (NOLOAD) : /* battery ram stay on during powerdown but needs to be handled specially */
|
.heap3 ALIGN(0x1000) (NOLOAD) :
|
||||||
|
{
|
||||||
|
__heap3_size = ORIGIN(ram_usb) + LENGTH(ram_usb) - ABSOLUTE(.);
|
||||||
|
PROVIDE(__heap3_start = . );
|
||||||
|
. += __heap3_size;
|
||||||
|
PROVIDE(__heap3_max = .);
|
||||||
|
} > ram_usb
|
||||||
|
__heap_size = SIZEOF(.heap3);
|
||||||
|
|
||||||
|
|
||||||
|
.batteryram (NOLOAD) : /* battery ram stays on during powerdown but needs to be handled specially */
|
||||||
{
|
{
|
||||||
*(.batteryram)
|
*(.batteryram)
|
||||||
} > ram_battery
|
} > ram_battery
|
||||||
|
|||||||
@ -4,8 +4,11 @@ set timeout 5
|
|||||||
|
|
||||||
spawn pseudoterm $env(PORT)
|
spawn pseudoterm $env(PORT)
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
send "\n"
|
||||||
|
send "\n"
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +19,7 @@ expect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,11 @@ set timeout 5
|
|||||||
|
|
||||||
spawn pseudoterm $env(PORT)
|
spawn pseudoterm $env(PORT)
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
send "\n"
|
||||||
|
send "\n"
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +19,7 @@ expect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,11 @@ set timeout 5
|
|||||||
|
|
||||||
spawn pseudoterm $env(PORT)
|
spawn pseudoterm $env(PORT)
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
send "\n"
|
||||||
|
send "\n"
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +19,7 @@ expect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
">$" {}
|
">" {}
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user