From 4b13d3c659240e5a8347b1ba7ab0bf1d8355eba3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 24 Oct 2012 22:46:55 -0700 Subject: altos: Add stack-guard code. Uses STM MPU to trap stack overflow. This marks the lowest portion of the stack as inaccessible to the CPU, causing the processor to fault when it reaches it. The fault then generates a panic message so that the user can know what happened. Signed-off-by: Keith Packard --- src/stm-bringup/Makefile | 2 +- src/stm-bringup/ao.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/stm-bringup/ao.h (limited to 'src/stm-bringup') diff --git a/src/stm-bringup/Makefile b/src/stm-bringup/Makefile index d45e836d..5cc94bd9 100644 --- a/src/stm-bringup/Makefile +++ b/src/stm-bringup/Makefile @@ -12,7 +12,7 @@ PDCLIB=/home/keithp/sat C_LIB=$(PDCLIB)/lib/pdclib.a C_INC=-I$(PDCLIB)/include -DEF_CFLAGS=-g -std=gnu99 -Os -mlittle-endian -mthumb -ffreestanding -nostdlib -I../../src/stm $(C_INC) +DEF_CFLAGS=-g -std=gnu99 -Os -mlittle-endian -mthumb -ffreestanding -nostdlib -I. -I../../src/stm $(C_INC) # to run from SRAM LD_FLAGS_RAM=-L../stm -Wl,-Taltos-ram.ld diff --git a/src/stm-bringup/ao.h b/src/stm-bringup/ao.h new file mode 100644 index 00000000..27204fae --- /dev/null +++ b/src/stm-bringup/ao.h @@ -0,0 +1,18 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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; version 2 of the License. + * + * This program 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#define ao_panic(n) for(;;); -- cgit v1.2.3 From 8c05f608c8f103649c1e5ec0d5742621e233af78 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 22 Apr 2013 11:06:36 -0500 Subject: Move cortex toolchain to /opt/cortex Signed-off-by: Keith Packard --- src/stm-bringup/Makefile | 4 ++-- src/stm/Makefile.defs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/stm-bringup') diff --git a/src/stm-bringup/Makefile b/src/stm-bringup/Makefile index 5cc94bd9..1bc5aaad 100644 --- a/src/stm-bringup/Makefile +++ b/src/stm-bringup/Makefile @@ -8,8 +8,8 @@ endif CC=arm-none-eabi-gcc OBJCOPY=arm-none-eabi-objcopy -PDCLIB=/home/keithp/sat -C_LIB=$(PDCLIB)/lib/pdclib.a +PDCLIB=/opt/cortex +C_LIB=$(PDCLIB)/lib/pdclib-cortex-m3.a C_INC=-I$(PDCLIB)/include DEF_CFLAGS=-g -std=gnu99 -Os -mlittle-endian -mthumb -ffreestanding -nostdlib -I. -I../../src/stm $(C_INC) diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs index 04404cdc..1480f0b3 100644 --- a/src/stm/Makefile.defs +++ b/src/stm/Makefile.defs @@ -8,8 +8,8 @@ vpath matrix.5c ../kalman vpath ao-make-product.5c ../util CC=arm-none-eabi-gcc -SAT=/home/keithp/sat -SAT_CLIB=$(SAT)/lib/pdclib.a +SAT=/opt/cortex +SAT_CLIB=$(SAT)/lib/pdclib-cortex-m3.a SAT_CFLAGS=-I$(SAT)/include ifndef VERSION -- cgit v1.2.3 From 2e092b383d55bcf9e2a230ccfe85052adb18b254 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 27 Apr 2013 00:23:14 -0700 Subject: altos: Make stm-bringup build again stm requires AO_BOOT_LOADER_BASE now Signed-off-by: Keith Packard --- src/stm-bringup/ao.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/stm-bringup') diff --git a/src/stm-bringup/ao.h b/src/stm-bringup/ao.h index 27204fae..2c7d5282 100644 --- a/src/stm-bringup/ao.h +++ b/src/stm-bringup/ao.h @@ -16,3 +16,5 @@ */ #define ao_panic(n) for(;;); + +#define AO_BOOT_LOADER_BASE ((uint32_t *) 0x0) -- cgit v1.2.3