Forum Replies Created
-
AuthorPosts
-
szengerParticipant
Hello again. Thanks for your reply!
As changing the SWD clock has no effect on the timing, except the flashing process, this also would suggest that the issue is local. I’ve been looking into GDB to create index files. Sadly could not get
arm-none-eabi-gdb-add-index
to work properly, so I’ve been trying the manual approach via https://sourceware.org/gdb/onlinedocs/gdb/Index-Files.html:c:\sysgcc\arm-eabi_10.3.1_10.2.90_r1\bin\arm-none-eabi-gdb VisualGDB/Debug/NXPiMX
save gdb-index .gdb-add-index
creates something likeNXPiMX.gdb-index-1V35ZY
in.gdb-add-index
. However, it statesError while writing index for C:\src\gsh\src\fw\VisualGDB\Debug\NXPiMX': rename: Permission denied.
C:\src\gsh\src\fw>c:\sysgcc\arm-eabi_10.3.1_10.2.90_r1\bin\arm-none-eabi-objcopy --add-section .gdb_index=indexes\NXPiMX.gdb-index-1V35ZY --set-section-flags .gdb_index=readonly VisualGDB/Debug/NXPiMX VisualGDB/Debug/NXPiMX
, which changes theVisualGDB/Debug/NXPiMX
file from around 19MB to 20MB.- So far, so good in GDB I
set index-cache on
– however, notice no difference at all. At the end of the session I receive
show index-cache stats
&"show index-cache stats\n"
Cache hits (this session): 0
Cache misses (this session): 0
..which puzzles me. What am I missing to turn on the indexing properly?
Aside from that,
- I have tried the same scenario with
-ggdb
,-g3
,-gdwarf-2
-gdwarf-4
but could not see any difference. The crashes mentioned above usually follow timeouts, trying to read the values. In general, if any command goes up to something like 60 seconds the whole debugging session just crashes without any error.
*EDIT* In raw GDB I receive
(gdb) break C:\src\gsh\src\fw\Configuration\ConfigurationManager.h:18
../../gdb/gdb/utils.c:671: internal-error: virtual memory exhausted: can't allocate 4064 bytes.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
- We use different toolchains already. There is no difference.
- The set backtrace limit command definitely is helpful here, thanks a lot!
- I’ll still have to look into any timing differences when stripping debug information from most of the object files. Though, this probably might not be a good option for most cases. Going to update this next week.
Thank you!
Best,
StefanszengerParticipantThank you so much for your reply!
I can tell already which commands are responsible for the most delay (see attachments):
-break-insert -f …
-stack-list-frames --thread 1
Mind the one that takes 29 seconds to complete. If I
step into
this further, the debugger eventually will just crash and disconnect without an error. Eachstep into
orstep over
can take several seconds. Even worse, hovering over variables might do the same and/or crash the session.Best,
StefanAttachments:
You must be logged in to view attached files.szengerParticipantI didn’t know that applies for embedded setups too! But that worked well indeed, thanks!
For anyone else reading this thread, stripping debug information flag is not capital S, but also capital S apparently.
-s
=-Wl,-S
, but not-S
szengerParticipantWhen setting this option it also got removed from linker command, thanks!
The hardcoded breakpoint works like a charm and shows in the disassembly as expected too. (The debugger should be fine because it works in NXP’s native example projects.) How do I fix debugging symbols for embedded devices in custom projects in VisualGDB? Is this related to the BSP and different type of memory being used by default?
Attachments:
You must be logged in to view attached files.szengerParticipantThis explains a lot. Then there (probably) is no memory alignment issue in first place. I also finally managed to find the culprit in the linker command: Both
-mfloat-abi=hard
and-mfloat-abi=soft
are defined. If-mfloat-abi=hard
is removed the code works. By now I do not know if this is correct, though. Now remains to,- Find where to disable
-mfloat-abi=hard
in the project settings. It seems to be added automatically somewhere outside of Properties -> Linker? - And more importantly, why the Debugger cannot set any breakpoints or map any code. Anything is “Frame not in module”. Any directions where to start here?
Thanks!
szengerParticipantThank you for this command. None of both ELF files actually show the memory partitioning from the linker file (like
m_ivt
orSRAM_DTC
, see attachments in previous post). Where does the embedded memory explorer get this information from? The controller/board in question has three memory setups for code execution: External Hyperflash/QSPI or internal RAM. Could the (presumably wrong) information origin from the project setup? Would this lead to more wrong settings due to?I also simply copied a ELF file from the MSBuild setup to the mbed-cli one – and it looks fine this way.
szengerParticipantHello again,
I’m not using the preprocessor for linker files on MSBuild. Instead the setup currently uses the file from mbed-cli after preprocessing, which is identical to the linker file from MSBuild after preprocessing – aside of unused
#define
s in the header. All the processed linker files from MSBuild, mbed-cli or gmake are identical.Sadly, it currently looks like there are issues in the object files as well as the linker command. I’ve narrowed the object files down to a folder within mbed-os, but whether those are changed or the linker command it breaks the build.
What is most puzzling, however: When copying the.elf
file from the mbed-cli compilation (and renaming accordingly), the embedded memory explorer still shows a broken layout (see attachments in last post)? But if I delete the.elf
file, it indeed says the file does not exist. Is this expected behavior?szengerParticipantHello!
Thanks for your reply. The embedded memory explorer indeed did reveal an alignment issue. Oddly, the sections are placed correctly, while the whole alignment is off (see attachments).
Both builds use an identical linker script. I could not findSRAM_DTC
,SRAM_ITC
orSRAM_OC
anywhere within the project at all (Visual Studio CTL+SHIFT+F). Memory alignment in both files looks like:[...]
MEMORY
{
m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000
m_ivt (RX) : ORIGIN = 0x60000000 + 0x1000, LENGTH = 0x00001000
m_interrupts (RX) : ORIGIN = 0x60000000 + 0x2000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x60000000 + 0x2400, LENGTH = 0x400000 - 0x2400
m_text2 (RX) : ORIGIN = 0x00000000, LENGTH = 0x00020000
m_data (RW) : ORIGIN = 0x80000000, LENGTH = 0x01E00000
m_ncache (RW) : ORIGIN = 0x81E00000, LENGTH = 0x00200000
m_data2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
m_data3 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00040000
}
SECTIONS
{
.flash_config :
{
. = ALIGN(8);
__FLASH_BASE = .;
KEEP(* (.boot_hdr.conf))
. = ALIGN(8);
} > m_flash_config
ivt_begin= ORIGIN(m_flash_config) + LENGTH(m_flash_config);
.ivt : AT(ivt_begin)
{
[...]I also wrote a script to extract each command along with the
*.rsp
files from theProjectName-Debug.bat
and compared the output with the commands$make
would use. This totals at 906 toolchain calls for gnu make and 905 for VisualGDB. We managed to identify the additional call as the preprocessing of the linker script. While we didn’t get too deep into the compile and assemble commands so far, we tried to look closely at the linking, but could not find any significant difference.make (1017+711+61600 columns, last being .link_options.txt)
arm-none-eabi-cpp -E -P -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -Wl,--wrap,printf -Wl,--wrap,sprintf -Wl,--wrap,snprintf -Wl,--wrap,vprintf -Wl,--wrap,vsprintf -Wl,--wrap,vsnprintf -Wl,--wrap,fprintf -Wl,--wrap,vfprintf -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=softfp -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -MMD -fomit-frame-pointer -Og -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_MINIMAL_PRINTF -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=softfp -DMBED_RAM1_START=0x0 -DMBED_RAM1_SIZE=0x20000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x60000 -DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 .././mbed-os/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/TOOLCHAIN_GCC_ARM/MIMXRT1052xxxxx.ld -o nxp_wsl_gmake.link_script.ld
arm-none-eabi-gcc -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -Wl,--wrap,printf -Wl,--wrap,sprintf -Wl,--wrap,snprintf -Wl,--wrap,vprintf -Wl,--wrap,vsprintf -Wl,--wrap,vsnprintf -Wl,--wrap,fprintf -Wl,--wrap,vfprintf -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=softfp -DMBED_RAM1_START=0x0 -DMBED_RAM1_SIZE=0x20000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x60000 -DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -T nxp_wsl_gmake.link_script.ld --output nxp_wsl_gmake.elf @.link_options.txt -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
VisualGDB (total of 81355 columns)
arm-none-eabi-g++.exe -o VisualGDB/Debug/IMXRT1050_NXP -Wl,-gc-sections -T./PreprocessedLinkerScript.ld --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -Wl,--wrap,printf -Wl,--wrap,sprintf -Wl,--wrap,snprintf -Wl,--wrap,vprintf -Wl,--wrap,vsprintf -Wl,--wrap,vsnprintf -Wl,--wrap,fprintf -Wl,--wrap,vfprintf -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=softfp -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x60000 -DMBED_RAM1_START=0x0 -DMBED_RAM1_SIZE=0x20000 -DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mcpu=cortex-m7 -Wl,--start-group VisualGDB/Debug/main.o [...] -lm -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
Is it even possible that this alignment issue could be caused by the compiled files before linking? Or would it make sense to dissect the prior build process (900+ lines) after all? Thanks!
Attachments:
You must be logged in to view attached files. -
AuthorPosts