gdb with linkserver cannot access ram on mimxrt1060_evk@A

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gdb with linkserver cannot access ram on mimxrt1060_evk@A

Jump to solution
1,326 Views
laodzu
Contributor IV

Debugging an LVGL problem I noted that using linkserver, I cannot access the DRAM from within gdb. Here is a sample session with only the relevant bits:

 

(zephyr-venv) dzu@krikkit:/opt/src/git/zephyrproject/zephyr (lvgl-bad)$ west debug -d build/mimxrt1060_evk@A/mimxrt1062/qspi/ -r linkserver
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner linkserver
RUNNER - gdb_port = 3333, semih port = 8888
-- runners.linkserver: LinkServer: /usr/local/LinkServer/LinkServer, version v24.12.21
GNU gdb (Zephyr SDK 0.16.8) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
[...]
(gdb) b mcux_elcdif_init 
Breakpoint 1 at 0x6000a864: file /opt/src/git/zephyrproject/zephyr/drivers/display/display_mcux_elcdif.c, line 321.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, mcux_elcdif_init (dev=0x6003e800 <__device_dts_ord_461>) at /opt/src/git/zephyrproject/zephyr/drivers/display/display_mcux_elcdif.c:321
321		const struct mcux_elcdif_config *config = dev->config;
(gdb) n
322		struct mcux_elcdif_data *dev_data = dev->data;
(gdb) n
325		err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
(gdb) p/x *dev_data
Cannot access memory at address 0x80000360
(gdb) 

 

Looking at the known memory regions, indeed the region at 0x80000000 is missing:

(gdb) mon info
Chip=MIMXRT1062xxxxA, from NXP, in family MIMXRT1060, version=unknown
Chip Description: NXP MIMXRT1062xxxxA
System reset doesn't cause power cycle. Last reset cause(s): CannotGetCause
Does not have Flash and is not programmable. 128M pop
Mem memoryInstance_0 of type RAM from 20000000 for 131072 bytes. 
Mem memoryInstance_1 of type RAM from 0000 for 131072 bytes. 
Mem memoryInstance_2 of type RAM from 20200000 for 524288 bytes. 
Mem memoryInstance_3 of type RAM from 20280000 for 262144 bytes. 
Mem memoryInstance_4 of type ExtFlash from 60000000 for 8388608 bytes. 
PrgFlash from 60000000 to 60800000 (8388608 bytes), 128 pages of 8192K
  'Word' width: 4. Cannot read after programming starts
CPUID=0x0C27, Little-Endian. Name=CM7, Chip=MIMXRT1062xxxxA,
CpuNum=7, Rev=7.0, MaxInts=160, SysTickCal=03E7
State is: Stopped (Was Reset)  [Reset from Unknown] (stop cause: VectorCatch:Reset (PC unknown: stack=0x20201000))
(gdb)

When I use the `pyocd` runner, I can see the variables just fine:

(gdb) b mcux_elcdif_init 
Breakpoint 1 at 0x6000a864: file /opt/src/git/zephyrproject/zephyr/drivers/display/display_mcux_elcdif.c, line 321.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, mcux_elcdif_init (dev=0x6003e800 <__device_dts_ord_461>) at /opt/src/git/zephyrproject/zephyr/drivers/display/display_mcux_elcdif.c:321
321		const struct mcux_elcdif_config *config = dev->config;
(gdb) n
322		struct mcux_elcdif_data *dev_data = dev->data;
(gdb) 
325		err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
(gdb) p/x *dev_data
$1 = {active_fb = 0x0, fb = {0x0, 0x0}, pixel_format = 0x20, pixel_bytes = 0x0, fb_bytes = 0x0, rgb_mode = {
    panelWidth = 0x0, panelHeight = 0x0, hsw = 0x0, hfp = 0x0, hbp = 0x0, vsw = 0x0, vfp = 0x0, vbp = 0x0, 
    polarityFlags = 0x0, bufferAddr = 0x0, pixelFormat = 0x0, dataBus = 0x0}, sem = {wait_q = {waitq = {{
          head = 0x0, next = 0x0}, {tail = 0x0, prev = 0x0}}}, count = 0x0, limit = 0x0, poll_events = {{
        head = 0x0, next = 0x0}, {tail = 0x0, prev = 0x0}}}, next_idx = 0x0}
(gdb) p/x dev_data
$2 = 0x80000360
(gdb) mon show map
 Region   Type   Start       End         Size        Access  Sector      Page       
 itcm     Ram    0x00000000  0x0007ffff  0x00080000  rwx     -           -          
 romcp    Rom    0x00200000  0x0021ffff  0x00020000  rx      -           -          
 dtcm     Ram    0x20000000  0x2007ffff  0x00080000  rwx     -           -          
 ocram    Ram    0x20200000  0x2027ffff  0x00080000  rwx     -           -          
 flexspi  Flash  0x60000000  0x607fffff  0x00800000  rx      0x00010000  0x00000100 
 semc     Ram    0x80000000  0x81dfffff  0x01e00000  rwx     -           -          
(gdb) 

I guess the fix is a simple one line add somewhere in the relevant mapping file for imxrt1060?

0 Kudos
Reply
1 Solution
868 Views
laodzu
Contributor IV

Ok, the attached patch solves the problem for me. Would it be possible to include this in future releases?

 

Thanks in advance!

View solution in original post

5 Replies
896 Views
laodzu
Contributor IV

Ok, here is a minimal example using one of the provided examples, e.g. button:

(zephyr-venv) dzu@krikkit:/opt/src/git/zephyrproject/zephyr (lvgl-bad)$ west build -b mimxrt1060_evk@A/mimxrt1062/qspi samples/basic/button/ -- -DCONFIG_DEBUG_OPTIMIZATIONS=y
...
(zephyr-venv) dzu@krikkit:/opt/src/git/zephyrproject/zephyr (lvgl-bad)$ west debug -d build/mimxrt1060_evk@A/mimxrt1062/qspi/ -r linkserver
....
(gdb) b main.c:72
Breakpoint 1 at 0x6000261c: file /opt/src/git/zephyrproject/zephyr/samples/basic/button/src/main.c, line 72.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, main () at /opt/src/git/zephyrproject/zephyr/samples/basic/button/src/main.c:72
72		printk("Set up button at %s pin %d\n", button.port->name, button.pin);
(gdb) p button_cb_data
Cannot access memory at address 0x800001f0
(gdb) 

The same with pyocd:

(zephyr-venv) dzu@krikkit:/opt/src/git/zephyrproject/zephyr (lvgl-bad)$ west debug -d build/mimxrt1060_evk@A/mimxrt1062/qspi/ -r pyocd
...
(gdb) b main.c:72
Breakpoint 1 at 0x6000261c: file /opt/src/git/zephyrproject/zephyr/samples/basic/button/src/main.c, line 72.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, main () at /opt/src/git/zephyrproject/zephyr/samples/basic/button/src/main.c:72
72		printk("Set up button at %s pin %d\n", button.port->name, button.pin);
(gdb) p button_cb_data
$1 = {node = {next = 0x0}, handler = 0x0, pin_mask = 0}
(gdb) 

I attach the whole transcript for your convenience, so you can see the details of what is going on. Let me know if you need any further info to reproduce the problem.

0 Kudos
Reply
869 Views
laodzu
Contributor IV

Ok, the attached patch solves the problem for me. Would it be possible to include this in future releases?

 

Thanks in advance!

828 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @laodzu ,

 

Thanks for the sharing! I will forward to the expert.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
930 Views
laodzu
Contributor IV

Hi Kan,

I tried one of the Zephyr LVGL examples on the NXP MIMXRT1060 eval board, I still have revision A, but to reproduce this, you also need a display which is not part of the standard EVK if I remember correctly. I think this should show up in any application that you try to debug, but I will retry this with a smaller Zephyr example and will then post the instructions here.

The original problem I try to solve is documented in this ticket: https://github.com/zephyrproject-rtos/zephyr/issues/94473

0 Kudos
Reply
1,273 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @laodzu ,

 

Which demo are you debugging on RT1060? Was it a EVK or custom board? Is there any repo link for this demo? Please kindly clarify. I will try to reproduce this issue here.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

 

0 Kudos
Reply