Make blinky example work for the cortex M4 and the cortex M0

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by floreste on Fri Jun 27 06:21:11 MST 2014
I have some troubles programing a MCU and would appreciate some enlighten.
I am trying to program the LPC 4337 (The Xplorer board) with the LPC Link-2 debug probe in order to run a simple blinky program on cortex M4 and M0 in sleep, and then to run the same program with the cortex M0 and M4 in sleep. As IDE for programming I am using the NXPXpresso IDE.
I have already managed to run my program in the M4 but I’m experiencing troubles for the M0 part: I can’t make any project work.
Here is what I have understood and tried, please tell me what I did wrong or what I have missed.
I first tried to run the examples from the LPCopen package. Since I have a LPC4337 board, I have changed the settings for the examples and put LPC4337 for the M4 examples and LPC4337-M0 for the M0 examples.
I wanted to try the blinky projects, and here is the first thing I have noticed:
Periph_blinky and freertos_blinky examples seems to work, (connected with JTAG for cortex M4 and without any link to M0APP in the settings (Settings->tool Settings->MCU Linker->Multicore) ) when they are programmed independently from the M0.
But first problem, with the same settings as the other working examples, the dc_sa_blinky example ends in the HardFault_Handler, according to what I’ve seen, after checking if the M0 image was correctly loaded, which could not since I hadn’t already linked the M4 project to the M0 one.
Then, I tried to make the _m0 examples work by themselves changing the settings to LPC4337-M0 and using the JTAG dedicated for the M0 but then, I am each time “stalled on bus operation” (this message is displayed on the bottom of the NXPXpresso IDE).  I guess that I can’t run a program only dedicated for the M0 since the M4 has to boot the M0 core?
So I tried to link the 2 projects to run a multi core program, and here is where I would like some help to guide me in the rights steps.
- I built the dc_sa_blinky_m0 project
- I change the settings of the dc_sa_blinky (for M4) project (Settings->tool Settings->MCU Linker->Multicore) where I check off the M0APP slave, I do not change Master memory (I tried both MFlashA512 and RAM2 nevertheless) and I define the slave application with the image built for the dc_sa_blinky_m0 program.
So this should link the slave M0 to the master M4? Do I forget another step, another configuration?
Then I launch the debug but I end in the HardFault_Handler another time, just after checking if the image was correctly loaded (after line 217 of the m0_img_loader from the dc_sa_blinky example.
So could someone help me there and tell me what I’m doing wrong.
(I get the same errors for the dc_freertos_blinky project)