/* * Multi-core example for LPC4337 (Cortex-M4 + Cortex-M0) * This code runs on Cortex-M4. It enables the M0 core, load a small * application into it and start it. */ /* Binary image of m0_main.c */ extern char _binary_m0_main_bin_start; extern char _binary_m0_main_bin_end; extern int _binary_m0_main_bin_size; void _start() { volatile unsigned int delay; volatile unsigned int *gpio1_dir = (unsigned int *)0x400F6004; volatile unsigned int *gpio1_inv = (unsigned int *)0x400F6304; volatile unsigned int *reset_ctrl1 = (unsigned int *)0x40053104; unsigned char *m0_code_dst = (unsigned char *)0x20000000; unsigned char *m0_code_src = (unsigned char *)&_binary_m0_main_bin_start; unsigned int m0_code_size = (int)&_binary_m0_main_bin_size; // setup SP and PC values for M0 core *m0_code_dst++ = 0x00; // SP = 0x20001000 *m0_code_dst++ = 0x10; *m0_code_dst++ = 0x00; *m0_code_dst++ = 0x20; *m0_code_dst++ = 0x09; // PC = 0x20000009 *m0_code_dst++ = 0x00; *m0_code_dst++ = 0x00; *m0_code_dst++ = 0x20; // copy M0 core code for (delay = 0; delay < m0_code_size; delay++) *m0_code_dst++ = *m0_code_src++; // start M0 core *reset_ctrl1 = 0x01000000; *reset_ctrl1 = 0; // set GPIOs direction *gpio1_dir = 0x1800; while (1) { /* invert one GPIO - trigger orange LED on LPC433x-Xplorer board */ *gpio1_inv = 0x1000; // wait a little for (delay = 0; delay < 100000/2; delay++) ; } }