I tried to simulate the instruction execution on Arduino nano 33 ble sense. So using Keil MDK, I selected nrf52480 as a device for simulation and used the initialization file to debug from the main function. But when I started debug session, the simulation stayed at the first line assembly code at the address 0x00000000. I doubted that I haven't set up the right value of CPU DLL and Dialog DLL. The default value of CPU DLL is "SARMCM3.DLL -MPU" and that of Dialog DLL is "DCM.DLL -pCM4". Very appreciate it if someone can answer my question.
Have you used/enabled any peripheral in your project? If yes, refer to this page developer.arm.com/.../latest
I have checked this page but I couldn't find appropriate parameters for nrf52480. Besides, I also tried to use Cortex-m4 for simulation but it doesn't make sense.
I'm afraid you didn't get the point of the page posted above.
That page tells you that there are only very limited cortex-m devices support peripherals simulation. For most of cortex-m devices, only "CPU core" simulation is supported.
So nrf52480 simulator can only support "CPU core" simulation? But do you know how to simulate the instruction execution correctly? Now I didn't change anything in default but the simulator kept executing the first line assembly code.
The weird thing is that when I changed the CPU DLL and Dialog DLL, the corresponding assembly code shown in the debug session was changed. So I guess that by setting up the right value of CPU DLL and Dialog DLL, we can get the simulator to work correctly.
Using the "led_softblink_pca10040 (nRF52 PCA10040)" example project from the Pack Installer of uVision, when i set the simulation parameters like these
The core simulation works fine for me as shown here
The peripheral simulation for this device is not support.
Oh, but the problem is that it is tricky to debug the original C source code in Keil MDK. So I can only get the elf file and set up the initialization file for debugging. The initialization file is shown in the following graph.
Do you not have the option of debugging it on the target? Rather than simulating...
Yeah, I tried to use JLink Edu debugger. The problem is that the debugging session will be stuck in the exception handling program (It can only execute several instructions again and again.). And it seems that using JLink Edu debugger cannot get the # of instructions executed. However, my main objective is to get the number of instructions executed for one specific complex function.
OK, I'm not knowledgeable in that issue. You can get an STLink V2 or clone very cheaply (and hook it up to a demo board with the same core) as an alternative perhaps.
Oh, this may be an interesting solution. I will try it. Thank you.
I used the STLINK V2 to debug STM32L476RG. But the debugging session is stuck in the "mbed error" function. Do you know the reason?
What was the previous instruction?
At the beginning of the debugging session, the first instruction is at "SetSysClock_PLL_MSI". Then the debugging session will invoke "UART_SetConfig" and "Set_GPIO_Clock". But when I run the debugging command "step over", it will execute "Reset_Handler" many times and I am not sure if the debugging session is stuck in this function. However, when I run the code and randomly stop code execution, I find these functions mentioned above from the "call stack window".
I also tried to use JLINK EDU to debug Arduino nano 33 ble sense board. Using Keil MDK, I set up the "Device" as NRF52840_xxAA and use the real debugger JLINK EDU. But the problem is that the event counters, like CPICNT and LSUCNT, will overflow. I have checked the debugger configuration again and again but couldn't figure out where the problem is. Very appreciate it if someone could point at the problem. Thanks so much.
View all questions in Keil forum