mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge branch 'mc1322x' of github.com:RIOT-OS/RIOT into mc1322x
This commit is contained in:
commit
3dba62afa6
@ -1,3 +1,4 @@
|
||||
# set undefined variables
|
||||
ifeq ($(strip $(RIOTCPU)),)
|
||||
export RIOTCPU =$(RIOTBASE)/cpu
|
||||
endif
|
||||
@ -11,8 +12,9 @@ BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z')
|
||||
CFLAGS += -DBOARD=$(BB)
|
||||
export CFLAGS
|
||||
|
||||
# mandatory include!
|
||||
# mandatory includes!
|
||||
include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
||||
include $(RIOTCPU)/Makefile.include
|
||||
include $(RIOTBASE)/Makefile.modules
|
||||
|
||||
# your binaries to link
|
||||
|
@ -1,26 +1,7 @@
|
||||
export MAKEBASE =$(RIOTBASE)
|
||||
export BINDIR =$(RIOTBASE)/bin/
|
||||
UNDEF = $(BINDIR)startup.o
|
||||
UNDEF += $(BINDIR)startup.o
|
||||
|
||||
### Minimal setup
|
||||
ifeq ($(CPU),lpc2387)
|
||||
USEMODULE += arm_common
|
||||
UNDEF += $(BINDIR)syscalls.o
|
||||
export INCLUDES += -I$(RIOTBASE)/cpu/arm_common/include
|
||||
endif
|
||||
ifeq ($(CPU),lpc214x)
|
||||
USEMODULE += arm_common
|
||||
UNDEF += $(BINDIR)syscalls.o
|
||||
endif
|
||||
ifeq ($(CPU),native)
|
||||
export INCLUDES += -I$(RIOTBASE)/cpu/native/include
|
||||
endif
|
||||
ifeq ($(CPU),stm32f407vgt6)
|
||||
USEMODULE += stm32f4xxstdperi
|
||||
UNDEF += $(BINDIR)syscalls.o
|
||||
endif
|
||||
|
||||
#USEMODULE += cpu_drivers cpu core lib sys
|
||||
USEMODULE += cpu core sys
|
||||
ED = $(USEMODULE:%=-DMODULE_%)
|
||||
EXTDEFINES = $(shell echo $(ED)|tr 'a-z' 'A-Z')
|
||||
|
@ -33,8 +33,6 @@
|
||||
#define ENABLE_DEBUG
|
||||
#include <debug.h>
|
||||
|
||||
volatile tcb_t *sched_threads[MAXTHREADS];
|
||||
volatile tcb_t *active_thread;
|
||||
volatile int lpm_prevent_sleep = 0;
|
||||
|
||||
extern void main(void);
|
||||
|
@ -75,10 +75,10 @@ int thread_wakeup(int pid) {
|
||||
}
|
||||
}
|
||||
|
||||
int thread_measure_stack_usage(char* stack) {
|
||||
unsigned int* stackp = (unsigned int*)stack;
|
||||
int thread_measure_stack_usage(char *stack) {
|
||||
unsigned int *stackp = (unsigned int*) (void*) stack;
|
||||
/* assumption that the comparison fails before or after end of stack */
|
||||
while( *stackp == (unsigned int)stackp )
|
||||
while (*stackp == (unsigned int)stackp)
|
||||
stackp++;
|
||||
|
||||
int space = (unsigned int)stackp - (unsigned int)stack;
|
||||
@ -109,8 +109,8 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
|
||||
|
||||
if (flags & CREATE_STACKTEST) {
|
||||
/* assign each int of the stack the value of it's address */
|
||||
unsigned int *stackmax = (unsigned int*) ((char*)stack + stacksize);
|
||||
unsigned int* stackp = (unsigned int*)stack;
|
||||
unsigned int *stackmax = (unsigned int*) (void*) (stack + stacksize);
|
||||
unsigned int *stackp = (unsigned int*)(void*)stack;
|
||||
while(stackp < stackmax) {
|
||||
*stackp = (unsigned int)stackp;
|
||||
stackp++;
|
||||
|
10
cpu/Makefile
10
cpu/Makefile
@ -1,9 +1,13 @@
|
||||
ifeq ($(CPU),lpc2387)
|
||||
DIRS = arm_common lpc2387
|
||||
DIRS = arm_common lpc_common lpc2387
|
||||
endif
|
||||
|
||||
ifeq ($(CPU),lpc214x)
|
||||
DIRS = arm_common lpc214x
|
||||
DIRS = arm_common lpc_common lpc214x
|
||||
endif
|
||||
|
||||
ifeq ($(CPU),mc1322x)
|
||||
DIRS = arm_common mc1322x
|
||||
endif
|
||||
|
||||
ifeq ($(CPU),cc430)
|
||||
@ -28,6 +32,8 @@ $(DIRS):
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C lpc2387 clean
|
||||
@$(MAKE) -C mc1322x clean
|
||||
@$(MAKE) -C lpc_common clean
|
||||
@$(MAKE) -C arm_common clean
|
||||
@$(MAKE) -C cc430 clean
|
||||
@$(MAKE) -C msp430-common clean
|
||||
|
@ -1,11 +1,17 @@
|
||||
ifeq ($(CPU),lpc2387)
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/arm_common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/lpc_common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/lpc2387/include
|
||||
endif
|
||||
ifeq ($(CPU),lpc214x)
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/arm_common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/lpc_common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/lpc214x/include
|
||||
endif
|
||||
ifeq ($(CPU),mc1322x)
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/arm_common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/mc1322x/include
|
||||
endif
|
||||
ifeq ($(CPU),msp430x16x)
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/msp430-common/include/
|
||||
INCLUDES += -I$(MAKEBASE)/cpu/msp430x16x/include/
|
||||
|
21
cpu/Makefile.include
Normal file
21
cpu/Makefile.include
Normal file
@ -0,0 +1,21 @@
|
||||
### Minimal setup
|
||||
ifeq ($(CPU),lpc2387)
|
||||
export USEMODULE += arm_common lpc_common
|
||||
export UNDEF += $(BINDIR)syscalls.o
|
||||
export INCLUDES += -I$(RIOTCPU)/arm_common/include
|
||||
export INCLUDES += -I$(RIOTCPU)/lpc_common/include
|
||||
endif
|
||||
ifeq ($(CPU),lpc214x)
|
||||
export USEMODULE += arm_common lpc_common
|
||||
export UNDEF += $(BINDIR)syscalls.o
|
||||
export INCLUDES += -I$(RIOTCPU)/arm_common/include
|
||||
export INCLUDES += -I$(RIOTCPU)/lpc_common/include
|
||||
endif
|
||||
ifeq ($(CPU),mc1322x)
|
||||
export USEMODULE += arm_common
|
||||
export UNDEF += $(BINDIR)syscalls.o
|
||||
export INCLUDES += -I$(RIOTBASE)/cpu/arm_common/include
|
||||
endif
|
||||
ifeq ($(CPU),native)
|
||||
export INCLUDES += -I$(RIOTBASE)/cpu/native/include
|
||||
endif
|
@ -85,13 +85,3 @@ void thread_print_stack(void)
|
||||
}
|
||||
printf("STACK (%u)= %X \n",i,*s);
|
||||
}
|
||||
|
||||
__attribute__((naked,noreturn)) void arm_reset(void)
|
||||
{
|
||||
dINT();
|
||||
WDTC = 0x00FFF;
|
||||
WDMOD = 0x03;
|
||||
WDFEED= 0xAA;
|
||||
WDFEED= 0x55;
|
||||
while(1);
|
||||
}
|
||||
|
@ -1,27 +1,17 @@
|
||||
/******************************************************************************
|
||||
Copyright 2008, Freie Universitaet Berlin (FUB). All rights reserved.
|
||||
|
||||
These sources were developed at the Freie Universitaet Berlin, Computer Systems
|
||||
and Telematics group (http://cst.mi.fu-berlin.de).
|
||||
-------------------------------------------------------------------------------
|
||||
This file is part of RIOT.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
RIOT is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* syscalls.c - arm system calls
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lpc2387
|
||||
* @ingroup arm_common
|
||||
* @brief LPC2387 NewLib system calls implementation
|
||||
*
|
||||
* @author Freie Universität Berlin, Computer Systems & Telematics
|
||||
@ -36,6 +26,8 @@ this program. If not, see http://www.gnu.org/licenses/ .
|
||||
#include <sys/stat.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "arm_cpu.h"
|
||||
// core
|
||||
#include "kernel.h"
|
||||
#include "irq.h"
|
||||
@ -64,7 +56,6 @@ this program. If not, see http://www.gnu.org/licenses/ .
|
||||
* @name Heaps (defined in linker script)
|
||||
* @{
|
||||
*/
|
||||
#define NUM_HEAPS 3//2
|
||||
|
||||
extern uintptr_t __heap1_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap1_max; ///< maximum for end of heap memory space
|
||||
@ -73,25 +64,6 @@ extern uintptr_t __heap2_max; ///< maximum for end of heap memory space
|
||||
extern uintptr_t __heap3_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap3_max; ///< maximum for end of heap memory space
|
||||
|
||||
|
||||
/// current position in heap
|
||||
static caddr_t heap[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start}; // add heap3 before heap2 cause Heap3 address is lower then addr of heap2
|
||||
/// maximum position in heap
|
||||
static const caddr_t heap_max[NUM_HEAPS] = {(caddr_t)&__heap1_max,(caddr_t)&__heap3_max,(caddr_t)&__heap2_max};
|
||||
// start position in heap
|
||||
static const caddr_t heap_start[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void heap_stats(void)
|
||||
{
|
||||
for(int i = 0; i < NUM_HEAPS; i++)
|
||||
printf("# heap %i: %p -- %p -> %p (%li of %li free)\n", i, heap_start[i], heap[i], heap_max[i],
|
||||
(uint32_t)heap_max[i] - (uint32_t)heap[i], (uint32_t)heap_max[i] - (uint32_t)heap_start[i]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void __assert_func(const char *file, int line, const char *func, const char *failedexpr)
|
||||
{
|
||||
@ -107,45 +79,7 @@ void __assert(const char *file, int line, const char *failedexpr)
|
||||
{
|
||||
__assert_func(file, line, "?", failedexpr);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
caddr_t _sbrk_r(struct _reent *r, size_t incr)
|
||||
{
|
||||
if(incr < 0)
|
||||
{
|
||||
puts("[syscalls] Negative Values for _sbrk_r are not supported");
|
||||
r->_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t cpsr = disableIRQ();
|
||||
|
||||
/* check all heaps for a chunk of the requested size */
|
||||
for (volatile uint8_t iUsedHeap = 0; iUsedHeap < NUM_HEAPS; iUsedHeap++ ) {
|
||||
caddr_t new_heap = heap[iUsedHeap] + incr;
|
||||
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, heap[iUsedHeap]);
|
||||
#endif
|
||||
if( new_heap <= heap_max[iUsedHeap] ) {
|
||||
caddr_t prev_heap = heap[iUsedHeap];
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, new_heap);
|
||||
#endif
|
||||
heap[iUsedHeap] = new_heap;
|
||||
|
||||
r->_errno = 0;
|
||||
restoreIRQ(cpsr);
|
||||
return prev_heap;
|
||||
}
|
||||
}
|
||||
restoreIRQ(cpsr);
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_string(TRACELOG_EV_MEMORY, "heap!"); // heap full
|
||||
#endif
|
||||
|
||||
r->_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _isatty_r(struct _reent *r, int fd)
|
||||
{
|
||||
@ -158,6 +92,10 @@ int _isatty_r(struct _reent *r, int fd)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
_off_t _lseek_r(struct _reent *r, int fd, _off_t pos, int whence)
|
||||
{
|
||||
/* to get rid of gcc warnings */
|
||||
(void) fd;
|
||||
(void) pos;
|
||||
(void) whence;
|
||||
_off_t result = -1;
|
||||
PRINTF("lseek [%i] pos %li whence %i\n", fd, pos, whence);
|
||||
|
||||
@ -172,6 +110,9 @@ _off_t _lseek_r(struct _reent *r, int fd, _off_t pos, int whence)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _open_r(struct _reent *r, const char *name, int mode)
|
||||
{
|
||||
/* to get rid of gcc warnings */
|
||||
(void) name;
|
||||
(void) mode;
|
||||
int ret = -1;
|
||||
PRINTF("open '%s' mode %#x\n", name, mode);
|
||||
|
||||
@ -186,6 +127,9 @@ int _open_r(struct _reent *r, const char *name, int mode)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _stat_r(struct _reent *r, char *name, struct stat *st)
|
||||
{
|
||||
/* to get rid of gcc warnings */
|
||||
(void) name;
|
||||
(void) st;
|
||||
int ret = -1;
|
||||
PRINTF("_stat_r '%s' \n", name);
|
||||
r->_errno = ENODEV; // no such device
|
||||
@ -253,6 +197,10 @@ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _read_r(struct _reent *r, int fd, void *buffer, unsigned int count)
|
||||
{
|
||||
/* to get rid of gcc warnings */
|
||||
(void) fd;
|
||||
(void) buffer;
|
||||
(void) count;
|
||||
int result = -1;
|
||||
r->_errno = EBADF;
|
||||
#ifdef MODULE_FAT
|
||||
@ -266,6 +214,7 @@ int _read_r(struct _reent *r, int fd, void *buffer, unsigned int count)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _close_r(struct _reent *r, int fd)
|
||||
{
|
||||
(void) fd;
|
||||
int result = -1;
|
||||
r->_errno = EBADF;
|
||||
#ifdef MODULE_FAT
|
||||
@ -279,6 +228,9 @@ int _close_r(struct _reent *r, int fd)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int _unlink_r(struct _reent *r, char* path)
|
||||
{
|
||||
/* get rid of gcc warnings */
|
||||
(void) path;
|
||||
|
||||
int result = -1;
|
||||
r->_errno = ENODEV;
|
||||
#ifdef MODULE_FAT
|
||||
|
@ -1,28 +1,14 @@
|
||||
/******************************************************************************
|
||||
Copyright 2008-2009, Freie Universitaet Berlin (FUB). All rights reserved.
|
||||
Copyright 2013, Freie Universitaet Berlin (FUB). All rights reserved.
|
||||
|
||||
These sources were developed at the Freie Universitaet Berlin, Computer Systems
|
||||
and Telematics group (http://cst.mi.fu-berlin.de).
|
||||
-------------------------------------------------------------------------------
|
||||
This file is part of RIOT.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
RIOT is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see http://www.gnu.org/licenses/ .
|
||||
--------------------------------------------------------------------------------
|
||||
For further information and questions please use the web site
|
||||
http://scatterweb.mi.fu-berlin.de
|
||||
and the mailinglist (subscription via web site)
|
||||
scatterweb@lists.spline.inf.fu-berlin.de
|
||||
*******************************************************************************/
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*/
|
||||
|
||||
/* specify the LPC2387 memory areas (see LPC2387 datasheet page 15) */
|
||||
MEMORY
|
||||
|
4
cpu/lpc_common/Makefile
Normal file
4
cpu/lpc_common/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
MODULE =lpc_common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
#define VULP(x) ((volatile unsigned long*) (x))
|
||||
|
||||
/// High level interrupt handler
|
||||
/* High level interrupt handler */
|
||||
static void (*int_handler)(int);
|
||||
|
||||
/// Timer 0-3 interrupt handler
|
||||
/* Timer 0-3 interrupt handler */
|
||||
static void timer_irq(void) __attribute__((interrupt("IRQ")));
|
||||
|
||||
inline static unsigned long get_base_address(short timer) {
|
@ -1,13 +1,13 @@
|
||||
/* iap driver
|
||||
*
|
||||
* based on iap driver for LPC2148 Controller made by Andreas Weschenfelder, 2008
|
||||
* see:
|
||||
*
|
||||
*/
|
||||
|
||||
#include <irq.h>
|
||||
#include <flashrom.h>
|
||||
#include <iap.h>
|
||||
/* TODO: replace by a lpc generic header */
|
||||
#include <lpc2387.h>
|
||||
|
||||
//#define ENABLE_DEBUG
|
20
cpu/lpc_common/lpc_cpu.c
Normal file
20
cpu/lpc_common/lpc_cpu.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* lpc_cpu.c - LPC architecture common support functions
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*
|
||||
*/
|
||||
|
||||
__attribute__((naked,noreturn)) void arm_reset(void)
|
||||
{
|
||||
dINT();
|
||||
WDTC = 0x00FFF;
|
||||
WDMOD = 0x03;
|
||||
WDFEED= 0xAA;
|
||||
WDFEED= 0x55;
|
||||
while(1);
|
||||
}
|
75
cpu/lpc_common/lpc_syscalls.c
Normal file
75
cpu/lpc_common/lpc_syscalls.c
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* syscalls.c - MCU dependent syscall implementation for LPCXXXX
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/**
|
||||
* @name Heaps (defined in linker script)
|
||||
* @{
|
||||
*/
|
||||
#define NUM_HEAPS 3
|
||||
|
||||
extern uintptr_t __heap1_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap1_max; ///< maximum for end of heap memory space
|
||||
extern uintptr_t __heap2_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap2_max; ///< maximum for end of heap memory space
|
||||
extern uintptr_t __heap3_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap3_max; ///< maximum for end of heap memory space
|
||||
|
||||
/// current position in heap
|
||||
static caddr_t heap[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start}; // add heap3 before heap2 cause Heap3 address is lower then addr of heap2
|
||||
/// maximum position in heap
|
||||
static const caddr_t heap_max[NUM_HEAPS] = {(caddr_t)&__heap1_max,(caddr_t)&__heap3_max,(caddr_t)&__heap2_max};
|
||||
// start position in heap
|
||||
static const caddr_t heap_start[NUM_HEAPS] = {(caddr_t)&__heap1_start,(caddr_t)&__heap3_start,(caddr_t)&__heap2_start};
|
||||
|
||||
/** @} */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void heap_stats(void)
|
||||
{
|
||||
for(int i = 0; i < NUM_HEAPS; i++)
|
||||
printf("# heap %i: %p -- %p -> %p (%li of %li free)\n", i, heap_start[i], heap[i], heap_max[i],
|
||||
(uint32_t)heap_max[i] - (uint32_t)heap[i], (uint32_t)heap_max[i] - (uint32_t)heap_start[i]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
caddr_t _sbrk_r(struct _reent *r, size_t incr)
|
||||
{
|
||||
uint32_t cpsr = disableIRQ();
|
||||
|
||||
/* check all heaps for a chunk of the requested size */
|
||||
for (volatile uint8_t iUsedHeap = 0; iUsedHeap < NUM_HEAPS; iUsedHeap++ ) {
|
||||
caddr_t new_heap = heap[iUsedHeap] + incr;
|
||||
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, heap[iUsedHeap]);
|
||||
#endif
|
||||
if( new_heap <= heap_max[iUsedHeap] ) {
|
||||
caddr_t prev_heap = heap[iUsedHeap];
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, new_heap);
|
||||
#endif
|
||||
heap[iUsedHeap] = new_heap;
|
||||
|
||||
r->_errno = 0;
|
||||
restoreIRQ(cpsr);
|
||||
return prev_heap;
|
||||
}
|
||||
}
|
||||
restoreIRQ(cpsr);
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_string(TRACELOG_EV_MEMORY, "heap!"); // heap full
|
||||
#endif
|
||||
|
||||
r->_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
12
cpu/mc1322x/Makefile
Normal file
12
cpu/mc1322x/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
MODULE =cpu
|
||||
|
||||
DIRS =
|
||||
|
||||
all: $(BINDIR)$(MODULE).a
|
||||
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
clean::
|
||||
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;
|
||||
|
19
cpu/mc1322x/cpu.c
Normal file
19
cpu/mc1322x/cpu.c
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* cpu.c - MC1322X architecture common support functions
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mc1322x.h"
|
||||
|
||||
__attribute__((naked,noreturn)) void arm_reset(void)
|
||||
{
|
||||
dINT();
|
||||
CRM->SW_RST = SW_RST_VAL;
|
||||
while(1);
|
||||
}
|
51
cpu/mc1322x/hwtimer_cpu.c
Normal file
51
cpu/mc1322x/hwtimer_cpu.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* hwtimer_cpu.c - architecture dependent hardware timer functionality
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mc1322x.h"
|
||||
|
||||
/* TODO: do scaling voodoo */
|
||||
#define COUNT_MODE 1 /* use rising edge of primary source */
|
||||
#define PRIME_SRC 0xf /* Perip. clock with 128 prescale (for 24Mhz = 187500Hz)*/
|
||||
#define SEC_SRC 0 /* don't need this */
|
||||
#define ONCE 0 /* keep counting */
|
||||
#define LEN 0 /* continue counting */
|
||||
#define DIR 0 /* count up */
|
||||
#define CO_INIT 0 /* other counters cannot force a re-initialization of this counter */
|
||||
#define OUT_MODE 0 /* OFLAG is asserted while counter is active */
|
||||
|
||||
/* High level interrupt handler */
|
||||
static void (*int_handler)(int);
|
||||
|
||||
void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) {
|
||||
int_handler = handler;
|
||||
/* Reset the timer */
|
||||
TMR0->ENBL = 0;
|
||||
/* Clear status */
|
||||
TMR0->SCTRL = 0;
|
||||
/* disable interrupt */
|
||||
TMR0->CSCTRL =0x0000;
|
||||
/* Reload/initialize to zero */
|
||||
TMR0->LOAD = 0;
|
||||
|
||||
/* disable comparison */
|
||||
TMR0->COMP1 = 0;
|
||||
TMR0->CMPLD1 = 0;
|
||||
|
||||
/* set counter to zero */
|
||||
TMR0->CNTR = 0;
|
||||
|
||||
/* TODO: do scaling voodoo */
|
||||
(void) fcpu;
|
||||
/* TODO: use struct */
|
||||
TMR0->CTRL = (COUNT_MODE<<13) | (PRIME_SRC<<9) | (SEC_SRC<<7) | (ONCE<<6) | (LEN<<5) | (DIR<<4) | (CO_INIT<<3) | (OUT_MODE);
|
||||
TMR0->ENBL = 0xf; /* enable all the timers --- why not? */
|
||||
|
||||
}
|
61
cpu/mc1322x/include/cpu-conf.h
Normal file
61
cpu/mc1322x/include/cpu-conf.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* cpu.h - mc1322x specific definitions
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT
|
||||
*/
|
||||
|
||||
#ifndef CPUCONF_H_
|
||||
#define CPUCONF_H_
|
||||
|
||||
/**
|
||||
* @ingroup conf
|
||||
* @ingroup mc1322x
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief MC1322X CPUconfiguration
|
||||
*
|
||||
* @author Oleg Hahm
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Stdlib configuration
|
||||
* @{
|
||||
*/
|
||||
#define __FOPEN_MAX__ 4
|
||||
#define __FILENAME_MAX__ 12
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Kernel configuration
|
||||
* @{
|
||||
*/
|
||||
#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
|
||||
#define KERNEL_CONF_STACKSIZE_DEFAULT 4500
|
||||
#endif
|
||||
|
||||
#define KERNEL_CONF_STACKSIZE_IDLE 500
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Compiler specifics
|
||||
* @{
|
||||
*/
|
||||
#define CC_CONF_INLINE inline
|
||||
#define CC_CONF_USED __attribute__((used))
|
||||
#define CC_CONF_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#define CC_CONF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
/** @} */
|
||||
|
||||
#define TRANSCEIVER_BUFFER_SIZE (10)
|
||||
#define RX_BUF_SIZE (10)
|
||||
|
||||
/** @} */
|
||||
#endif /* CPUCONF_H_ */
|
18
cpu/mc1322x/include/cpu.h
Normal file
18
cpu/mc1322x/include/cpu.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* cpu.h - mc1322x specific definitions
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*/
|
||||
|
||||
#ifndef CPU_H
|
||||
#define CPU_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "arm_cpu.h"
|
||||
#include "mc1322x.h"
|
||||
|
||||
extern uintptr_t __stack_start; ///< end of user stack memory space
|
||||
|
||||
#endif /* CPU_H */
|
386
cpu/mc1322x/include/mc1322x.h
Normal file
386
cpu/mc1322x/include/mc1322x.h
Normal file
@ -0,0 +1,386 @@
|
||||
/*
|
||||
* mc1322x.h - mc1322x specific definitions
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*/
|
||||
|
||||
#ifndef MC1322X_H
|
||||
#define MC1322X_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
/* System Management */
|
||||
#define SW_RST_VAL (0x87651234)
|
||||
|
||||
#define CRM_BASE (0x80003000)
|
||||
|
||||
/* Structure-based CRM access */
|
||||
struct CRM_struct {
|
||||
union {
|
||||
uint32_t SYS_CNTL;
|
||||
struct CRM_SYS_CNTL {
|
||||
uint32_t PWR_SOURCE:2;
|
||||
uint32_t PADS_1P8V_SEL:1;
|
||||
uint32_t :1;
|
||||
uint32_t JTAG_SECU_OFF:1;
|
||||
uint32_t XTAL32_EXISTS:1;
|
||||
uint32_t :2;
|
||||
uint32_t XTAL_CLKDIV:6;
|
||||
uint32_t :18;
|
||||
} SYS_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t WU_CNTL;
|
||||
struct CRM_WU_CNTL {
|
||||
uint32_t TIMER_WU_EN:1;
|
||||
uint32_t RTC_WU_EN:1;
|
||||
uint32_t HOST_WAKE:1;
|
||||
uint32_t AUTO_ADC:1;
|
||||
uint32_t EXT_WU_EN:4;
|
||||
uint32_t EXT_WU_EDGE:4;
|
||||
uint32_t EXT_WU_POL:4;
|
||||
uint32_t TIMER_WU_IEN:1;
|
||||
uint32_t RTC_WU_IEN:1;
|
||||
uint32_t :2;
|
||||
uint32_t EXT_WU_IEN:4;
|
||||
uint32_t :4;
|
||||
uint32_t EXT_OUT_POL:4;
|
||||
} WU_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t SLEEP_CNTL;
|
||||
struct CRM_SLEEP_CNTL {
|
||||
uint32_t HIB:1;
|
||||
uint32_t DOZE:1;
|
||||
uint32_t :2;
|
||||
uint32_t RAM_RET:2;
|
||||
uint32_t MCU_RET:1;
|
||||
uint32_t DIG_PAD_EN:1;
|
||||
uint32_t :24;
|
||||
} SLEEP_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t BS_CNTL;
|
||||
struct CRM_BS_CNTL {
|
||||
uint32_t BS_EN:1;
|
||||
uint32_t WAIT4IRQ:1;
|
||||
uint32_t BS_MAN_EN:1;
|
||||
uint32_t :2;
|
||||
uint32_t ARM_OFF_TIME:6;
|
||||
uint32_t :18;
|
||||
} BS_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t COP_CNTL;
|
||||
struct CRM_COP_CNTL {
|
||||
uint32_t COP_EN:1;
|
||||
uint32_t COP_OUT:1;
|
||||
uint32_t COP_WP:1;
|
||||
uint32_t :5;
|
||||
uint32_t COP_TIMEOUT:7;
|
||||
uint32_t :1;
|
||||
uint32_t COP_COUNT:7;
|
||||
uint32_t :9;
|
||||
} COP_CNTLbits;
|
||||
};
|
||||
uint32_t COP_SERVICE;
|
||||
union {
|
||||
uint32_t STATUS;
|
||||
struct CRM_STATUS {
|
||||
uint32_t SLEEP_SYNC:1;
|
||||
uint32_t HIB_WU_EVT:1;
|
||||
uint32_t DOZE_WU_EVT:1;
|
||||
uint32_t RTC_WU_EVT:1;
|
||||
uint32_t EXT_WU_EVT:4;
|
||||
uint32_t :1;
|
||||
uint32_t CAL_DONE:1;
|
||||
uint32_t COP_EVT:1;
|
||||
uint32_t :6;
|
||||
uint32_t VREG_BUCK_RDY:1;
|
||||
uint32_t VREG_1P8V_RDY:1;
|
||||
uint32_t VREG_1P5V_RDY:1;
|
||||
uint32_t :12;
|
||||
} STATUSbits;
|
||||
};
|
||||
union {
|
||||
uint32_t MOD_STATUS;
|
||||
struct CRM_MOD_STATUS {
|
||||
uint32_t ARM_EN:1;
|
||||
uint32_t MACA_EN:1;
|
||||
uint32_t ASM_EN:1;
|
||||
uint32_t SPI_EN:1;
|
||||
uint32_t GPIO_EN:1;
|
||||
uint32_t UART1_EN:1;
|
||||
uint32_t UART2_EN:1;
|
||||
uint32_t TMR_EN:1;
|
||||
uint32_t RIF_EN:1;
|
||||
uint32_t I2C_EN:1;
|
||||
uint32_t SSI_EN:1;
|
||||
uint32_t SPIF_EN:1;
|
||||
uint32_t ADC_EN:1;
|
||||
uint32_t :1;
|
||||
uint32_t JTA_EN:1;
|
||||
uint32_t NEX_EN:1;
|
||||
uint32_t :1;
|
||||
uint32_t AIM_EN:1;
|
||||
uint32_t :14;
|
||||
} MOD_STATUSbits;
|
||||
};
|
||||
uint32_t WU_COUNT;
|
||||
uint32_t WU_TIMEOUT;
|
||||
uint32_t RTC_COUNT;
|
||||
uint32_t RTC_TIMEOUT;
|
||||
uint32_t reserved1;
|
||||
union {
|
||||
uint32_t CAL_CNTL;
|
||||
struct CRM_CAL_CNTL {
|
||||
uint32_t CAL_TIMEOUT:16;
|
||||
uint32_t CAL_EN:1;
|
||||
uint32_t CAL_IEN:1;
|
||||
uint32_t :14;
|
||||
} CAL_CNTLbits;
|
||||
};
|
||||
uint32_t CAL_COUNT;
|
||||
union {
|
||||
uint32_t RINGOSC_CNTL;
|
||||
struct CRM_RINGOSC_CNTL {
|
||||
uint32_t ROSC_EN:1;
|
||||
uint32_t :3;
|
||||
uint32_t ROSC_FTUNE:5;
|
||||
uint32_t ROSC_CTUNE:4;
|
||||
uint32_t :19;
|
||||
} RINGOSC_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t XTAL_CNTL;
|
||||
struct CRM_XTAL_CNTL {
|
||||
uint32_t :8;
|
||||
uint32_t XTAL_IBIAS_SEL:4;
|
||||
uint32_t :4;
|
||||
uint32_t XTAL_FTUNE:5;
|
||||
uint32_t XTAL_CTUNE:5;
|
||||
uint32_t :6;
|
||||
} XTAL_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t XTAL32_CNTL;
|
||||
struct CRM_XTAL32_CNTL {
|
||||
uint32_t XTAL32_EN:1;
|
||||
uint32_t :3;
|
||||
uint32_t XTAL32_GAIN:2;
|
||||
uint32_t :26;
|
||||
} XTAL32_CNTLbits;
|
||||
};
|
||||
union {
|
||||
uint32_t VREG_CNTL;
|
||||
struct CRM_VREG_CNTL {
|
||||
uint32_t BUCK_EN:1;
|
||||
uint32_t BUCK_SYNC_REC_EN:1;
|
||||
uint32_t BUCK_BYPASS_EN:1;
|
||||
uint32_t VREG_1P5V_EN:2;
|
||||
uint32_t VREG_1P5V_SEL:2;
|
||||
uint32_t VREG_1P8V_EN:1;
|
||||
uint32_t BUCK_CLKDIV:4;
|
||||
uint32_t :20;
|
||||
} VREG_CNTLbits;
|
||||
};
|
||||
uint32_t reserved2;
|
||||
uint32_t SW_RST;
|
||||
uint32_t reserved3;
|
||||
uint32_t reserved4;
|
||||
uint32_t reserved5;
|
||||
uint32_t reserved6;
|
||||
};
|
||||
|
||||
static volatile struct CRM_struct * const CRM = (void*) (CRM_BASE);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
/* TIMERS */
|
||||
|
||||
#define F_CPU (24000000) ///< CPU target speed in Hz
|
||||
|
||||
/* Timer registers are all 16-bit wide with 16-bit access only */
|
||||
#define TMR_OFFSET (0x20)
|
||||
#define TMR_BASE (0x80007000)
|
||||
#define TMR0_BASE (TMR_BASE)
|
||||
#define TMR1_BASE (TMR_BASE + TMR_OFFSET*1)
|
||||
#define TMR2_BASE (TMR_BASE + TMR_OFFSET*2)
|
||||
#define TMR3_BASE (TMR_BASE + TMR_OFFSET*3)
|
||||
|
||||
struct TMR_struct {
|
||||
uint16_t COMP1;
|
||||
uint16_t COMP2;
|
||||
uint16_t CAPT;
|
||||
uint16_t LOAD;
|
||||
uint16_t HOLD;
|
||||
uint16_t CNTR;
|
||||
union {
|
||||
uint16_t CTRL;
|
||||
struct TMR_CTRL {
|
||||
uint16_t OUTPUT_MODE:3;
|
||||
uint16_t CO_INIT:1;
|
||||
uint16_t DIR:1;
|
||||
uint16_t LENGTH:1;
|
||||
uint16_t ONCE:1;
|
||||
uint16_t SECONDARY_CNT_SOURCE:2;
|
||||
uint16_t PRIMARY_CNT_SOURCE:4;
|
||||
uint16_t COUNT_MODE:3;
|
||||
} CTRLbits;
|
||||
};
|
||||
union {
|
||||
uint16_t SCTRL;
|
||||
struct TMR_SCTRL {
|
||||
uint16_t OEN:1;
|
||||
uint16_t OPS:1;
|
||||
uint16_t FORCE:1;
|
||||
uint16_t VAL:1;
|
||||
uint16_t EEOF:1;
|
||||
uint16_t MSTR:1;
|
||||
uint16_t CAPTURE_MODE:2;
|
||||
uint16_t INPUT:1;
|
||||
uint16_t IPS:1;
|
||||
uint16_t IEFIE:1;
|
||||
uint16_t IEF:1;
|
||||
uint16_t TOFIE:1;
|
||||
uint16_t TOF:1;
|
||||
uint16_t TCFIE:1;
|
||||
uint16_t TCF:1;
|
||||
} SCTRLbits;
|
||||
};
|
||||
uint16_t CMPLD1;
|
||||
uint16_t CMPLD2;
|
||||
union {
|
||||
uint16_t CSCTRL;
|
||||
struct TMR_CSCTRL {
|
||||
uint16_t CL1:2;
|
||||
uint16_t CL2:2;
|
||||
uint16_t TCF1:1;
|
||||
uint16_t TCF2:1;
|
||||
uint16_t TCF1EN:1;
|
||||
uint16_t TCF2EN:1;
|
||||
uint16_t :5;
|
||||
uint16_t FILT_EN:1;
|
||||
uint16_t DBG_EN:2;
|
||||
} CSCTRLbits;
|
||||
};
|
||||
|
||||
uint16_t reserved[4];
|
||||
|
||||
union {
|
||||
uint16_t ENBL;
|
||||
struct TMR_ENBL {
|
||||
union {
|
||||
struct {
|
||||
uint16_t ENBL:4;
|
||||
};
|
||||
struct {
|
||||
uint16_t ENBL3:1;
|
||||
uint16_t ENBL2:1;
|
||||
uint16_t ENBL1:1;
|
||||
uint16_t ENBL0:1;
|
||||
};
|
||||
};
|
||||
uint16_t :12;
|
||||
} ENBLbits;
|
||||
};
|
||||
};
|
||||
|
||||
static volatile struct TMR_struct * const TMR0 = (void *) (TMR0_BASE);
|
||||
static volatile struct TMR_struct * const TMR1 = (void *) (TMR1_BASE);
|
||||
static volatile struct TMR_struct * const TMR2 = (void *) (TMR2_BASE);
|
||||
static volatile struct TMR_struct * const TMR3 = (void *) (TMR3_BASE);
|
||||
|
||||
/* Get timer pointer from timer number */
|
||||
#define TMR_ADDR(x) (*(volatile struct TMR_struct *)(((uint32_t)(x) * TMR_OFFSET) + TMR_BASE))
|
||||
|
||||
/* Get timer number from the timer pointer. */
|
||||
#define TMR_NUM(x) (((uint32_t)(x) - TMR_BASE) / TMR_OFFSET)
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
/* UART */
|
||||
#define UART1_BASE (0x80005000)
|
||||
#define UART2_BASE (0x8000B000)
|
||||
|
||||
struct UART_struct {
|
||||
union {
|
||||
uint32_t CON;
|
||||
struct UART_CON {
|
||||
uint32_t :16;
|
||||
uint32_t TST:1;
|
||||
uint32_t MRXR:1;
|
||||
uint32_t MTXR:1;
|
||||
uint32_t FCE:1;
|
||||
uint32_t FCP:1;
|
||||
uint32_t XTIM:1;
|
||||
uint32_t :2;
|
||||
uint32_t TXOENB:1;
|
||||
uint32_t CONTX:1;
|
||||
uint32_t SB:1;
|
||||
uint32_t ST2:1;
|
||||
uint32_t EP:1;
|
||||
uint32_t PEN:1;
|
||||
uint32_t RXE:1;
|
||||
uint32_t TXE:1;
|
||||
} CONbits;
|
||||
};
|
||||
union {
|
||||
uint32_t STAT;
|
||||
struct UART_STAT {
|
||||
uint32_t :24;
|
||||
uint32_t TXRDY:1;
|
||||
uint32_t RXRDY:1;
|
||||
uint32_t RUE:1;
|
||||
uint32_t ROE:1;
|
||||
uint32_t TOE:1;
|
||||
uint32_t FE:1;
|
||||
uint32_t PE:1;
|
||||
uint32_t SE:1;
|
||||
} USTATbits;
|
||||
};
|
||||
union {
|
||||
uint32_t DATA;
|
||||
struct UART_DATA {
|
||||
uint32_t :24;
|
||||
uint32_t DATA:8;
|
||||
} DATAbits;
|
||||
};
|
||||
union {
|
||||
uint32_t RXCON;
|
||||
struct UART_URXCON {
|
||||
uint32_t :26;
|
||||
uint32_t LVL:6;
|
||||
} RXCONbits;
|
||||
};
|
||||
union {
|
||||
uint32_t TXCON;
|
||||
struct UART_TXCON {
|
||||
uint32_t :26;
|
||||
uint32_t LVL:6;
|
||||
} TXCONbits;
|
||||
};
|
||||
union {
|
||||
uint32_t CTS;
|
||||
struct UART_CTS {
|
||||
uint32_t :27;
|
||||
uint32_t LVL:5;
|
||||
} CTSbits;
|
||||
};
|
||||
union {
|
||||
uint32_t BR;
|
||||
struct UART_BR {
|
||||
uint32_t INC:16;
|
||||
uint32_t MOD:16;
|
||||
} BRbits;
|
||||
};
|
||||
};
|
||||
|
||||
static volatile struct UART_struct * const UART1 = (void *) (UART1_BASE);
|
||||
static volatile struct UART_struct * const UART2 = (void *) (UART2_BASE);
|
||||
|
||||
#endif /* MC1322X_H */
|
270
cpu/mc1322x/mc1322x.lds
Normal file
270
cpu/mc1322x/mc1322x.lds
Normal file
@ -0,0 +1,270 @@
|
||||
/* vim: set syntax=rpcgen : */
|
||||
/* Script for -z combreloc: combine and sort reloc sections */
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
||||
"elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_startup)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ram (rwx) : org = 0x00400000, l = 96K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
SYS_STACK_SIZE = 1024;
|
||||
IRQ_STACK_SIZE = 256;
|
||||
FIQ_STACK_SIZE = 256;
|
||||
SVC_STACK_SIZE = 256;
|
||||
ABT_STACK_SIZE = 16;
|
||||
UND_STACK_SIZE = 16;
|
||||
HEAP_SIZE = 4096;
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
PROVIDE (__executable_start = 0x00400000); . = 0x00400000;
|
||||
.text :
|
||||
{
|
||||
*(.startup)
|
||||
*(.irq)
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
|
||||
} =0
|
||||
|
||||
.interp : { *(.interp) }
|
||||
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
||||
.hash : { *(.hash) }
|
||||
.gnu.hash : { *(.gnu.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.dyn :
|
||||
{
|
||||
*(.rel.init)
|
||||
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
|
||||
*(.rel.fini)
|
||||
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
|
||||
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
|
||||
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
|
||||
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
|
||||
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
|
||||
*(.rel.ctors)
|
||||
*(.rel.dtors)
|
||||
*(.rel.got)
|
||||
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
|
||||
}
|
||||
.rela.dyn :
|
||||
{
|
||||
*(.rela.init)
|
||||
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
||||
*(.rela.fini)
|
||||
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
||||
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
||||
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
|
||||
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
|
||||
*(.rela.ctors)
|
||||
*(.rela.dtors)
|
||||
*(.rela.got)
|
||||
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
||||
}
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} =0
|
||||
.plt : { *(.plt) }
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} =0
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.eh_frame_hdr : { *(.eh_frame_hdr) }
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
|
||||
/* . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); */
|
||||
|
||||
. = ALIGN(4);
|
||||
. = DATA_SEGMENT_ALIGN(4,4);
|
||||
|
||||
/* Exception handling */
|
||||
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
|
||||
/* Thread Local Storage sections */
|
||||
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
||||
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
}
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
}
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
}
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
}
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = DATA_SEGMENT_RELRO_END (0, .);
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.data :
|
||||
{
|
||||
__data_start = . ;
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
SORT(CONSTRUCTORS)
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
_edata = .; PROVIDE (edata = .);
|
||||
|
||||
.stack : {
|
||||
__stack_start__ = . ;
|
||||
|
||||
. += IRQ_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__irq_stack_top__ = . ;
|
||||
|
||||
. += FIQ_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__fiq_stack_top__ = . ;
|
||||
|
||||
. += SVC_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__svc_stack_top__ = . ;
|
||||
|
||||
. += ABT_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__abt_stack_top__ = . ;
|
||||
|
||||
. += UND_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__und_stack_top__ = . ;
|
||||
|
||||
. += SYS_STACK_SIZE;
|
||||
. = ALIGN (4);
|
||||
__sys_stack_top__ = . ;
|
||||
|
||||
__stack_end__ = .;
|
||||
}
|
||||
|
||||
|
||||
__bss_start = .;
|
||||
__bss_start__ = .;
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections.
|
||||
FIXME: Why do we need it? When there is no .bss section, we don't
|
||||
pad the .data section. */
|
||||
. = ALIGN(. != 0 ? 32 / 8 : 1);
|
||||
}
|
||||
_bss_end__ = . ; __bss_end__ = . ;
|
||||
. = ALIGN(32 / 8);
|
||||
|
||||
.heap : {
|
||||
__heap_start__ = . ; PROVIDE(__HEAP_START = .);
|
||||
*(.heap);
|
||||
. += HEAP_SIZE;
|
||||
. = ALIGN (4);
|
||||
__heap_end__ = . ; PROVIDE(__HEAP_END = .);
|
||||
}
|
||||
|
||||
|
||||
. = ALIGN(32 / 8);
|
||||
__end__ = . ;
|
||||
_end = .; PROVIDE (end = .);
|
||||
. = DATA_SEGMENT_END (.);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
|
||||
}
|
56
cpu/mc1322x/mc1322x_syscalls.c
Normal file
56
cpu/mc1322x/mc1322x_syscalls.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* mc1322x_syscalls.c - MCU dependent syscall implementation
|
||||
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 3. See the file LICENSE for more details.
|
||||
*
|
||||
* This file is part of RIOT.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "irq.h"
|
||||
|
||||
extern uintptr_t __heap_start; ///< start of heap memory space
|
||||
extern uintptr_t __heap_end; ///< maximum for end of heap memory space
|
||||
|
||||
/// current position in heap
|
||||
static caddr_t heap = (caddr_t)&__heap_start;
|
||||
/// maximum position in heap
|
||||
static const caddr_t heap_max = (caddr_t)&__heap_end;
|
||||
// start position in heap
|
||||
static const caddr_t heap_start = (caddr_t)&__heap_start;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
caddr_t _sbrk_r(struct _reent *r, size_t incr)
|
||||
{
|
||||
uint32_t cpsr = disableIRQ();
|
||||
|
||||
/* check all heaps for a chunk of the requested size */
|
||||
caddr_t new_heap = heap + incr;
|
||||
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, heap);
|
||||
#endif
|
||||
if( new_heap <= heap_max ) {
|
||||
caddr_t prev_heap = heap;
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_pointer(TRACELOG_EV_MEMORY, new_heap);
|
||||
#endif
|
||||
heap = new_heap;
|
||||
|
||||
r->_errno = 0;
|
||||
restoreIRQ(cpsr);
|
||||
return prev_heap;
|
||||
}
|
||||
restoreIRQ(cpsr);
|
||||
#ifdef MODULE_TRACELOG
|
||||
trace_string(TRACELOG_EV_MEMORY, "heap!"); // heap full
|
||||
#endif
|
||||
|
||||
r->_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
183
cpu/mc1322x/startup.s
Normal file
183
cpu/mc1322x/startup.s
Normal file
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Mariano Alvira <mar@devl.org> and other contributors
|
||||
* to the MC1322x project (http:/*mc1322x.devl.org) and Contiki.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki OS.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
The following lincence is for all parts of this code done by
|
||||
Martin Thomas. Code from others used here may have other license terms.
|
||||
|
||||
Copyright (C) 2004 Martin THOMAS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
! The above copyright notice and this permission notice shall be included in all
|
||||
! copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs (program status registers) */
|
||||
.set MODE_USR, 0x10 /* Normal User Mode */
|
||||
.set MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */
|
||||
.set MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */
|
||||
.set MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */
|
||||
.set MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */
|
||||
.set MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode */
|
||||
.set MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks Mode */
|
||||
|
||||
.set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status registers) */
|
||||
.set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status registers) */
|
||||
|
||||
|
||||
.section .startup
|
||||
|
||||
.set _rom_data_init, 0x108d0
|
||||
.global _startup
|
||||
.func _startup
|
||||
|
||||
_startup:
|
||||
b _begin /* reset - _start */
|
||||
ldr PC, Undef_Addr /* Undefined Instruction */
|
||||
ldr PC, SWI_Addr /* Software Interrupt */
|
||||
ldr PC, PAbt_Addr /* Prefetch Abort */
|
||||
ldr PC, DAbt_Addr /* Data Abort */
|
||||
nop /* Reserved Vector (holds Philips ISP checksum) */
|
||||
/* see page 71 of "Insiders Guide to the Philips ARM7-Based Microcontrollers" by Trevor Martin */
|
||||
/* ldr PC, [PC,#-0x0120] /* Interrupt Request Interrupt (load from VIC) */
|
||||
ldr PC, IRQ_Addr /* Interrupt Request Interrupt (load from VIC) */
|
||||
ldr r0, =__fiq_handler /* Fast Interrupt Request Interrupt */
|
||||
|
||||
/* these vectors are used for rom patching */
|
||||
.org 0x20
|
||||
.code 16
|
||||
_RPTV_0_START:
|
||||
bx lr /* do nothing */
|
||||
|
||||
.org 0x60
|
||||
_RPTV_1_START:
|
||||
bx lr /* do nothing */
|
||||
|
||||
.org 0xa0
|
||||
_RPTV_2_START:
|
||||
bx lr /* do nothing */
|
||||
|
||||
.org 0xe0
|
||||
_RPTV_3_START:
|
||||
bx lr /* do nothing */
|
||||
|
||||
.org 0x120
|
||||
ROM_var_start: .word 0
|
||||
.org 0x7ff
|
||||
ROM_var_end: .word 0
|
||||
|
||||
.code 32
|
||||
.align
|
||||
_begin:
|
||||
/* FIQ mode stack */
|
||||
msr CPSR_c, #(MODE_FIQ | I_BIT | F_BIT)
|
||||
ldr sp, =__fiq_stack_top__ /* set the FIQ stack pointer */
|
||||
|
||||
/* IRQ mode stack */
|
||||
msr CPSR_c, #(MODE_IRQ | I_BIT | F_BIT)
|
||||
ldr sp, =__irq_stack_top__ /* set the IRQ stack pointer */
|
||||
|
||||
/* Supervisor mode stack */
|
||||
msr CPSR_c, #(MODE_SVC | I_BIT | F_BIT)
|
||||
ldr sp, =__svc_stack_top__ /* set the SVC stack pointer */
|
||||
|
||||
/* Undefined mode stack */
|
||||
msr CPSR_c, #(MODE_UND | I_BIT | F_BIT)
|
||||
ldr sp, =__und_stack_top__ /* set the UND stack pointer */
|
||||
|
||||
/* Abort mode stack */
|
||||
msr CPSR_c, #(MODE_ABT | I_BIT | F_BIT)
|
||||
ldr sp, =__abt_stack_top__ /* set the ABT stack pointer */
|
||||
|
||||
/* System mode stack */
|
||||
msr CPSR_c, #(MODE_SYS | I_BIT | F_BIT)
|
||||
ldr sp, =__sys_stack_top__ /* set the SYS stack pointer */
|
||||
|
||||
/* call the rom_data_init function in ROM */
|
||||
/* initializes ROM_var space defined by ROM_var_start and ROM_var_end */
|
||||
/* this area is used by ROM functions (e.g. nvm_read) */
|
||||
ldr r12,=_rom_data_init
|
||||
mov lr,pc
|
||||
bx r12
|
||||
|
||||
msr CPSR_c, #(MODE_SYS)
|
||||
|
||||
/* Clear BSS */
|
||||
clear_bss:
|
||||
ldr r0, _bss_start /* find start of bss segment */
|
||||
ldr r1, _bss_end /* stop here */
|
||||
mov r2, #0x00000000 /* clear */
|
||||
clbss_l:
|
||||
str r2, [r0] /* clear loop... */
|
||||
add r0, r0, #4
|
||||
cmp r0, r1
|
||||
blt clbss_l
|
||||
|
||||
b main
|
||||
|
||||
/* Exception vector handlers branching table */
|
||||
Undef_Addr: .word UNDEF_Routine /* defined in main.c */
|
||||
SWI_Addr: .word ctx_switch /* defined in main.c */
|
||||
PAbt_Addr: .word PABT_Routine /* defined in main.c */
|
||||
DAbt_Addr: .word DABT_Routine /* defined in main.c */
|
||||
IRQ_Addr: .word arm_irq_handler /* defined in main.c */
|
||||
__fiq_handler: .word __fiq /* FIQ */
|
||||
|
||||
__fiq: b . /* FIQ */
|
||||
|
||||
/*
|
||||
* These are defined in the board-specific linker script.
|
||||
*/
|
||||
.globl _bss_start
|
||||
_bss_start:
|
||||
.word __bss_start
|
||||
|
||||
.globl _bss_end
|
||||
_bss_end:
|
||||
.word _end
|
@ -1,3 +1,5 @@
|
||||
doc:
|
||||
doxygen riot.doxyfile
|
||||
|
||||
clean:
|
||||
@rm -rf latex man html
|
||||
|
@ -50,7 +50,7 @@ void chardev_loop(ringbuffer_t *rb) {
|
||||
msg_reply(&m, &m);
|
||||
}
|
||||
else {
|
||||
r = (struct posix_iop_t *)m.content.ptr;
|
||||
r = (struct posix_iop_t *)(void*)m.content.ptr;
|
||||
}
|
||||
break;
|
||||
case CLOSE:
|
||||
|
Loading…
Reference in New Issue
Block a user