Main /
Duktape Eclipse ARM Cortex M4OverviewThis section details the specific for using DUKtape on Cortex-M4 processor. In this case we select Tiva-C microcontroller. 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 Tiva-C (TM4C129N), select the mem.ld file and modify as shown below. Targeting Peripherals is the same as with Cortex-M3 Timer SetupAs with the Cortex-M3, we used on of the built-in timers to implement the gettimeof day function. The specifics are:
Tq = 1/16Mhz = 62.5uS Prescaler = 245 Tq_w_prescaler = 245 * 62.5uS = 0.0153s To get 1s = 1/Tq_w_prescaler = 65306 steps
int _gettimeofday(struct timeval *tv, void *tz) { unsigned long i,j; tv->tv_sec = sysSeconds; i = (65306 - (TIMER1->TAV & 0x00FFFF)); i *= 15312; // Every count from prescaler = 0.0153125 // Taking the remains from prescaler j = ((TIMER1->TAV & 0xFF0000) >> 16); j = 245-j; j *= 62; tv->tv_usec = i+j; return(0); } Duktape Event ExampleThis example consist on toggling a LED every 3 seconds using DUKtape. /* * Simple LED time test. */ function main() { setInterval(function () { LedControl.toggle(2); }, 3000); } main();
See Also
|