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?