From 2985d1b9f556658ffac12f613887d384558bda0b Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sat, 9 Jul 2011 15:13:29 +0200 Subject: [PATCH] Fix executor for adjustable ram size --- firmware/Makefile.inc | 4 ++-- firmware/applications/executor.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/firmware/Makefile.inc b/firmware/Makefile.inc index 1983ef8..1a6ddd2 100644 --- a/firmware/Makefile.inc +++ b/firmware/Makefile.inc @@ -7,7 +7,7 @@ TARGET = LPC13xx FLASH = 32K SRAM = 8K -RAMCODE=2K +RAMCODE=2048 # For USB HID support the LPC134x reserves 384 bytes from the sram, # if you don't want to use the USB features, just use 0 here. @@ -40,6 +40,6 @@ CPU_TYPE = cortex-$(CORTEX_TYPE) # Compiler settings, parameters and flags ########################################################################## -CFLAGS = -std=c99 -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin +CFLAGS = -std=c99 -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -DRAMCODE=$(RAMCODE) -fno-builtin LDFLAGS = -nostartfiles diff --git a/firmware/applications/executor.c b/firmware/applications/executor.c index 03d9637..24d186f 100644 --- a/firmware/applications/executor.c +++ b/firmware/applications/executor.c @@ -7,10 +7,12 @@ void backlightInit(void); +extern void * __sram_top; + void execute (const void *function, uint16_t length){ void (*dst)(void); - dst=(void (*)(void)) 0x10001c00; + dst=(void (*)(void)) (__sram_top); DoString(0,8,"Enter RAM!"); DoIntX(0,16,(uint32_t)function); @@ -58,7 +60,7 @@ void execute_file (const char * fname){ return; }; - res = f_read(&file, (char *)dst, 2048, &readbytes); + res = f_read(&file, (char *)dst, RAMCODE, &readbytes); put_rc_y(res,8); if(res){ return;