Main /
DuktapeEclipseARMCortexM3Based heavily on Duktape For ARM-Cortex M3 (accessible only to densoeal members) by Rene Vivanco OverviewThis section details the specific for using DUKtape on Cortex-M3 processor for DUKtape development. In this case we select LPC1768. Linker FileThe Linker file is responsible to accommodate the produced executable in the target processor. It shall match the memory map specifications of the target device. For the case of our specific device (LPC1768), select the mem.ld file and modify as shown below. Target Peripheral Memory AccessDuring device configuration and debugging, it is very useful to be able to see the peripheral memory behavior. In Eclipse it is possible to attach a device specific peripheral view. To enable it, follow the steps below
Timer SetupTo implement timeval we need a way to keep track of seconds and for microseconds since the system starts. One way to do this is using one of the built-in timers provided in the LPC1768 as follows.
int _gettimeofday(struct timeval *tv, void *tz) { // Read uS from Register tv->tv_usec = *T1TC; // Read Seconds from global variable tv->tv_sec = secs; return(0); }
void __attribute__ ((section(".after_vectors"),weak)) TMR1_IRQHandler (void) { // Clear ISR flag T1IR->MR0INT = 1; // Increment seconds secs++; } Accessor ConfigurationDukTape Configuration
#define __arm__ #define DUK_OPT_NO_JSON_STRINGIFY_FASTPATH #define DUK_OPT_NO_REFERENCE_COUNTING #define DUK_OPT_REFCOUNT16 #define DUK_OPT_STRHASH16 #define DUK_OPT_STRLEN16 #define DUK_OPT_BUGLEN16 #define DUK_OPT_OBJSIZES16 // Modify FILE definition as typedef void duk_file; // <<== This is just to compile since will not be a file system
#include "drv_hw.h" #include "duktape.h" void main() { duk_context *ctx = NULL; drv_boardInit(); ctx = duk_create_heap_default(); duk_destroy_heap(ctx); }
155,686 bytes of readonly code memory (Flash) 19,174 bytes of readonly data memory (Flash-constants) 4,368 bytes of R/w data memory (RAM) Notes
Current Issues
See Also
|