I have a SmartFusion2 based custom board which requires external DDR. SoftConsole and OpenOCD I have been used before with some cheap internal debugger.
Since this board has Pin tracing available and by design it was made to be able to use J-Trace Pro Cortex-M for traceability, I started to use J-Trace with Ozone.
First, I translated the DDR memory controller initialization part from OpenOCD compatible script to JLinkScript. I added all the register write operations in int AfterResetTarget() function. When I try to debug with Ozone, I see that the memory controller initialization and memory remapping it happens as it should be.
Unfortunately the "Download & Reset Program" does not halt in the first instruction, and does not reach to call main. Here is what I see in the Console area:
Display All
The PC and SP values seems correct.
Then I started somehow the firmware by SoftConsole. Since I have a switch to connect from internal debugger to external one, then I can "Attach & Halt program" in Ozone using J-Trace. From here I can see the counters alongside the sourcecode are working, I can break it and continue. Just the Timeline remain empty.
Unfortunately this unusual way to switch from one debugger to Ozone is not without error. Sometimes I have to try several times until it catches correctly.
What I would like to achieve, to find a solution to load the elf file by Ozone, use that memory remapping written in JLinkScript, which seems to work also, than after "Download & Reset Program" I would like to halt immediately and from there I can debug what is wrong with the startup that now with Ozone always enter in a wrong state right from the beginning.
I also tried to launch a J-Link GDB Server, pass the same JLinkScript file and debug from SoftConsole. There it seems to start correctly, despite I don't see the output from my JLinkScript. When I use J-Link GDB Server, do I see the output of JLinkScript, or that is possible to see only in the specially enabled log file which we pass to the GDB Server?
Just to converge the topics what I want to achieve, here are my two questions:
- How can I load a program in Ozone, then immediately halt?
- How I can use the JLinkScript for J-Link GDB Server, including to see the output in console or log file? In my case the DDR init and memory remapping has to be written in a script and I guess is there a way that both Ozone and J-Link GDB Server can share the same portion.
Since this board has Pin tracing available and by design it was made to be able to use J-Trace Pro Cortex-M for traceability, I started to use J-Trace with Ozone.
First, I translated the DDR memory controller initialization part from OpenOCD compatible script to JLinkScript. I added all the register write operations in int AfterResetTarget() function. When I try to debug with Ozone, I see that the memory controller initialization and memory remapping it happens as it should be.
Unfortunately the "Download & Reset Program" does not halt in the first instruction, and does not reach to call main. Here is what I see in the Console area:
Source Code
- P[0]: AHB-AP (IDR: 0x24770011)
- Iterating through AP map to find AHB-AP to use
- AP[0]: Core found
- AP[0]: AHB-AP ROM base: 0xE00FF000
- CPUID register: 0x412FC231. Implementer code: 0x41 (ARM)
- Found Cortex-M3 r2p1, Little endian.
- FPUnit: 6 code (BP) slots and 2 literal slots
- CoreSight components:
- ROMTbl[0] @ E00FF000
- [0][0]: E000E000 CID B105E00D PID 000BB000 SCS
- [0][1]: E0001000 CID B105E00D PID 003BB002 DWT
- [0][2]: E0002000 CID B105E00D PID 002BB003 FPB
- [0][3]: E0000000 CID B105E00D PID 003BB001 ITM
- [0][4]: E0040000 CID B105900D PID 003BB923 TPIU-Lite
- [0][5]: E0041000 CID B105900D PID 003BB924 ETM-M3
- Connected to target device.
- J-Link/J-Trace serial number: 932000486
- Reset: Halt core after reset via DEMCR.VC_CORERESET.
- Reset: Reset device via AIRCR.SYSRESETREQ.
- AfterResetTarget() start
- DDR2 Init...
- DDR2 Init done
- AfterResetTarget() end - Took 122ms
- Elf.GetBaseAddr(); // returns 0x0
- Target.ReadU32 (0x00000000); // returns 0x4, data is 0x4
- Target.SetReg ("SP", 0x4);
- Elf.GetEntryPointPC(); // returns 0x21EE0
- Target.SetReg ("PC", 0x21EE0);
- Elf.GetBaseAddr(); // returns 0x0
- Target.ReadU32 (0x00000000); // returns 0x4, data is 0x4
- Target.SetReg ("SP", 0x4);
- Elf.GetEntryPointPC(); // returns 0x21EE0
- Target.SetReg ("PC", 0x21EE0);
- Executed J-Link command "SelectTraceSource=1"
- Memory map 'after startup completion point' is active
Then I started somehow the firmware by SoftConsole. Since I have a switch to connect from internal debugger to external one, then I can "Attach & Halt program" in Ozone using J-Trace. From here I can see the counters alongside the sourcecode are working, I can break it and continue. Just the Timeline remain empty.
Unfortunately this unusual way to switch from one debugger to Ozone is not without error. Sometimes I have to try several times until it catches correctly.
What I would like to achieve, to find a solution to load the elf file by Ozone, use that memory remapping written in JLinkScript, which seems to work also, than after "Download & Reset Program" I would like to halt immediately and from there I can debug what is wrong with the startup that now with Ozone always enter in a wrong state right from the beginning.
I also tried to launch a J-Link GDB Server, pass the same JLinkScript file and debug from SoftConsole. There it seems to start correctly, despite I don't see the output from my JLinkScript. When I use J-Link GDB Server, do I see the output of JLinkScript, or that is possible to see only in the specially enabled log file which we pass to the GDB Server?
Just to converge the topics what I want to achieve, here are my two questions:
- How can I load a program in Ozone, then immediately halt?
- How I can use the JLinkScript for J-Link GDB Server, including to see the output in console or log file? In my case the DDR init and memory remapping has to be written in a script and I guess is there a way that both Ozone and J-Link GDB Server can share the same portion.