diff --git a/hw-tests/api-demo/flash.gdb b/hw-tests/api-demo/flash.gdb new file mode 100644 index 0000000000000000000000000000000000000000..1b9e60c0a785f39ef897ef9aa2f9c9ae193f0449 --- /dev/null +++ b/hw-tests/api-demo/flash.gdb @@ -0,0 +1,13 @@ +source ../../.gdbinit + +set confirm off + +echo Loading core1 image ... +file ../../build/hw-tests/api-demo/api-demo-core1.elf +load +echo Loading core0 image ... +file ../../build/hw-tests/api-demo/api-demo-core0.elf +load + +reset +quit diff --git a/hw-tests/api-demo/main.c b/hw-tests/api-demo/main.c index 41cb01232c5dc181263ad040b01544926687f2ae..a78e9ea666c583c858c6d2d9c8a880e37ace5f0b 100644 --- a/hw-tests/api-demo/main.c +++ b/hw-tests/api-demo/main.c @@ -5,6 +5,16 @@ #include "card10.h" #include "tmr_utils.h" +void Core1_Start(void) { + //MXC_GCR->gp0 = (uint32_t)(&__isr_vector_core1); + MXC_GCR->gp0 = 0x10040000; + MXC_GCR->perckcn1 &= ~MXC_F_GCR_PERCKCN1_CPU1; +} + +void Core1_Stop(void) { + MXC_GCR->perckcn1 |= MXC_F_GCR_PERCKCN1_CPU1; +} + int main(void) { int count = 0; diff --git a/hw-tests/api-demo/meson.build b/hw-tests/api-demo/meson.build index 071241b1f7f56b781f75f8e1519fdd9300729e1c..a86ba8c8fb254fd45a111e191862c1f842ece711 100644 --- a/hw-tests/api-demo/meson.build +++ b/hw-tests/api-demo/meson.build @@ -1,10 +1,22 @@ -name = 'api-demo' +name = 'api-demo-core0' executable( name + '.elf', 'main.c', - dependencies: [libcard10, max32665_startup], - link_whole: [max32665_startup_lib, board_card10_lib], + dependencies: [libcard10, max32665_startup_core0], + link_whole: [max32665_startup_core0_lib, board_card10_lib], + link_args: [ + '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', + ], +) + +name = 'api-demo-core1' + +executable( + name + '.elf', + 'test-payload.c', + dependencies: [libcard10, max32665_startup_core1], + link_whole: [max32665_startup_core1_lib, board_card10_lib], link_args: [ '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', ], diff --git a/hw-tests/api-demo/test-payload.c b/hw-tests/api-demo/test-payload.c new file mode 100644 index 0000000000000000000000000000000000000000..989c611a026d2241fcda709854fe1abe7e23ca7e --- /dev/null +++ b/hw-tests/api-demo/test-payload.c @@ -0,0 +1,21 @@ +#include "board.h" +#include "gpio.h" +#include "mxc_delay.h" + +static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; + +int main(void) +{ + // Enable rxev on core1 + MXC_GCR->evten |= 0x20; + for (int i = 0; 1; i++) { + __asm volatile("wfe"); + printf("core1: Hello! %d\n", i); + +#if 0 + GPIO_OutSet(&motor_pin); + mxc_delay(30000); + GPIO_OutClr(&motor_pin); +#endif + } +}