Hi,
We are developing a program which needs to be run from Flash. The program is working propertly when running from RAM but M3 core halts when running from flash. After debugging the problem has been narrowed to the following:
- M3 correctly starts C28 core
- C28 core calls a IPCLite function in order to communicate to the M3:
IPCLiteCtoMFunctionCall(IPC_FLAG1, pulMsgRam[0], buff_pos, IPC_FLAG32);
- C28 continues working ok
- M3 halts because trying to execute something at 0xfffffffe
In order to propertly run the code from Flash we have following all the recommend steps indicated in v130\F28M35x_examples_Dual\flash\m3\flash_m3.c. Additionally, the changes included in this thread: http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/p/116460/488697.aspx has been followed, except for the change from the IntRegister to IntRAMRegister, being the reason that the second one macro is not found.
I am using V1.30 version for the ControlSuite.
Attached are the .cmd and .map files for both cores.
7367.TarjetaAD_TCP_IP_m3_map.txt
[View:http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-3681.TarjetaAD_TCP_IP_C28_map.txt
2146.F28M35x_generic_wshared_C28_FLASH_cmd.txtfiles/171/7610.F28M35x_5F00_generic_5F00_wshared_5F00_M3_5F00_FLASH_5F00_cmd.txt]
Any help will be appreciated.
Regards,
Pablo
Pablo Garcia IPCLiteCtoMFunctionCall(IPC_FLAG1, pulMsgRam[0], buff_pos, IPC_FLAG32);
its possibly the above line of code. what is the address of the function that you are asking Master to call? This function sends an IPC message to master application, with the function address as parameter. Make sure that is what you want and also make sure that there is a valid function loaded on M3 before you send this message to it. You could repleace this function with a simple READ/WRITE IPCLite call and see if the application is good, then add on to it.
Please let us know if you have any more questions.
Best Regards
santosh
Dear Santosh,
yes, I've also checked that the address was ok. The function is located at the same address stored in the pointer (C28ADNewData). When I hit this problem it was my first idea, but no luck.
I will also try to test if a read IPC command works, but for our application we really need to call a function in order to make some actions.
Have you looked at the .map/.cmd files?
Pablo,
it could be that the function is not returning properly or corrupting the stack?
you can also put a break point in the function and step through and see? also try calling that function first from your M3 appication code and see if it returns properly.
Santosh,
the function never is called when using IPC, instead the code jumps directly to the address I posted in my first message. I also tried to call it directly from M3 and in that case it is executed ok, so it does not seem a corruption in the stack (at least not before the IPC call).
that means M3 is not able to get the address properly, can you give me the values of the below, that will help figure out what is going wrong here.
On C28x, before calling IPCLiteCtoMFunctionCall()
> what is the value of pulMsgRam[0] -> is it a 32 bit value?
> what is the value of buff_pos
On C28x, after calling IpcLiteCtoMFunctionCall()
what is the value of the below registers?
CtoMIpcRegs.CTOMIPCCOM = ?; CtoMIpcRegs.CTOMIPCADDR = ?; CtoMIpcRegs.CTOMIPCDATAW = ?;
Does M3 see IPC interrupt at all? if yes, can you put a break point in the interrupt service routine and give the values that M3 sees in its memory map for the above registers?
Does the application work fine if you don't call the IPCLiteCtoMFunctionCall, but instead call some any other simple read/write IPCLiteCtoM* call?
Santosh
- on C28x, before calling IPCLiteCtoMFunctionCall()
- value for pulMsgRam[0] is 0x2000075D, this is the address for the C28ADNewBuffer function in the M3 and it is a 23 bit value
- buff_pos is an index accessing a vector, its value in the first call is 0 as it should be
- these are the values for the registers in the C28x after calling IPCLiteCtoMFunctionCall()
CtoMIpcRegs.CTOMIPCCOM = 0x12; CtoMIpcRegs.CTOMIPCADDR = 0x2000075D; CtoMIpcRegs.CTOMIPCDATAW = 0;
As you can see, everything is right here. I also had made this debug before posting at the forum,
Even more, the M3 core is ok until the C28x forces IPC event:
CtoMIpcRegs.CTOMIPCSET.all |= (ulFlag | ulStatusFlag);
inside the IPCLiteCtoMFunctionCall()
- The M3 does not reach the interrupt handler, which is CtoMIPC1IntHandler. The address of the interrupt handler is 0x200006C4
- using other IPC call:
IPCLiteCtoMDataRead(IPC_FLAG1, pulMsgRam[0], IPC_LENGTH_32_BITS,IPC_FLAG32);
causes the same error and after executing
M3 core is again at 0xfffffffe
I have solved the problem. The CtoMIPC1IntHandler was not registered:
IntRegister(INT_CTOMPIC1, CtoMIPC1IntHandler);
I missed this one because it is also missed in your examples: F28M35x_examples_Dual\ctom_ipcdrivers_lite\m3\ctom_ipcdrivers_lite_m3.c
and because it works when executed from RAM. Where is the interrupt vector address assigned in that case?
I guess I know the issue, the examples have to be updated for running from flash yet. I should have asked whether you are running from flash or RAM earlier.
When the code is executed from RAM, NVIC TABLE is pointed to RAM locations in your main properly and that RAM location is initialized by the table during CCS load. When the code is linked to run from flash, no one is initializing the NVIC table in RAM but main is still pointing it to the location.
The IntRegister function call, checks for that error and auto corrects the scenario by copying the table from flash to RAM. If the main() doesn't call IntRegister, then the handler is not registers and the program goes to weeds. That is what is happening.
we are fixing the issue in next release of controlSuite.
Sorry for resurrecting this thread, but do you have an example of code that calls IntRegister?
Right now, all I am trying to do is get a simple program to run without the use of an emulator on a controlCard.
Will,
did you check the driverlib the interrupt.c file it should have functions that access the NVIC interrupt registers, if that is what you are asking?
which device you are trying on, F28M35x or F28M36x?
The 35x.
My problem is that I can not get any program running unless I run it from the emulator. I have tried using the blinky project, setting the M3 side to Flash or Flash Stand-alone and it will not run after a power cycle.
are the boot mode pins set to boot to flash? with emulator connected, after loading the application in flash, set a breakpoint at main() and do a debug reset and RUN. Device should run through the bootROM and enter main(), if that is working then I don't see a reason why it won't work in stand-alone.
Embarrassing! The jumper pins are set to ON by default on these controlCards which sets the Boot pins to all 0000...
I thought they were all off. SIGH!
It works now.