如何配置Lauterbach使加载多个ELF文件时保留所有符号?
Hey there! I’ve dealt with this exact annoyance in Lauterbach TRACE32 before—nothing’s more frustrating than loading multiple ELFs only to lose all but the last one’s symbols. Let’s break down the straightforward fixes to get all your symbols sticking around:
1. Use the NoClear Flag for Subsequent ELFs
By default, TRACE32 clears the existing symbol table every time you run Data.LOAD.Elf. Adding the NoClear parameter tells it to append new symbols instead of overwriting:
# Load your first ELF normally (this will clear any pre-existing symbols) Data.LOAD.Elf "bootloader.elf" # Load the second ELF without clearing the symbol table Data.LOAD.Elf "application.elf" NoClear # Add as many ELFs as needed, just include NoClear for each after the first Data.LOAD.Elf "driver_module.elf" NoClear
2. Specify a Base Address (If Needed)
If your ELFs have overlapping memory regions or their load addresses aren’t correctly defined, you might run into symbol collisions. Use the Base parameter to explicitly set where the ELF’s symbols map:
Data.LOAD.Elf "driver_module.elf" NoClear Base 0xA0000000
This ensures the new symbols are mapped to the correct memory space and don’t overwrite existing ones from other ELFs.
3. Manage Symbol Conflicts
If you have identical symbol names across ELFs (like multiple main functions), TRACE32 will overwrite the older symbol with the new one. To fix this:
- Rename conflicting symbols with
SYMbol.Rename:# Rename the first main to distinguish it SYMbol.Rename "main" "main_bootloader" - List all symbols to check for conflicts with
SYMbol.List
4. Use Symbol Domains for Organized Management
For more complex setups (e.g., multiple firmware components), TRACE32’s symbol domains let you group symbols by ELF. This keeps things clean and avoids accidental overwrites:
# Create a domain for your bootloader SYMbol.Domain.Create "BOOTLOADER" # Load the bootloader into its dedicated domain Data.LOAD.Elf "bootloader.elf" Domain BOOTLOADER # Create a domain for your application SYMbol.Domain.Create "APPLICATION" # Load the application into its domain (NoClear is still needed to keep the bootloader symbols) Data.LOAD.Elf "application.elf" Domain APPLICATION NoClear
You can switch between domains with SYMbol.Domain.Select APPLICATION or view symbols from a specific domain with SYMbol.List.Domain BOOTLOADER.
That’s it! The NoClear flag is your go-to for most cases, and symbol domains are perfect for larger projects where you need strict separation of symbols.
内容的提问来源于stack exchange,提问作者Cutton Eye

