From 4a82161bfceb0dbe7bf58393f398dae90bd19541 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Wed, 15 Jun 2011 23:42:22 +0200 Subject: [PATCH] Example for executing code in ram. Due to weird include magic call make two times. (we won't need this as soon as we can push these to the dataflash) make MODULE=executor loadables make MODULE=executor loadables --- modules/executor.c | 117 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 modules/executor.c diff --git a/modules/executor.c b/modules/executor.c new file mode 100644 index 0000000..4239a04 --- /dev/null +++ b/modules/executor.c @@ -0,0 +1,117 @@ +#include + +#include "basic/basic.h" + +#include "lcd/render.h" +#include "lcd/allfonts.h" + +void backlightInit(void); + +#include "loadable/blinktest.h" + +void execute (const void *function, uint16_t length){ + void (*dst)(void); + + dst=(void (*)(void)) 0x10001c00; + + DoString(0,8,"Enter RAM!"); + DoIntX(0,16,(uint32_t)function); + DoIntX(0,24,(uint32_t)dst); + lcdDisplay(0); + + for(int i=0;itrigger){ + ctr=0; + if (gpioGetValue(RB_LED2) == CFG_LED_OFF){ + gpioSetValue (RB_LED2, CFG_LED_ON); + } else { + gpioSetValue (RB_LED2, CFG_LED_OFF); + }; + }; + + // Print Voltage + font = &Font_7x8; + dx=DoString(0,yctr+28,"Voltage:"); + DoInt(dx,yctr+28,GetVoltage()); + + } + return; +} + +void tick_executor(void){ + static int foo=0; + static int toggle=0; + if(foo++>50){ + toggle=1-toggle; + foo=0; + gpioSetValue (RB_LED0, toggle); + }; + return; +}; + + +