Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to (properly) parse gcc linker file for ROM/.text section and custom sections #44

Open
daantimmer opened this issue Dec 3, 2018 · 0 comments

Comments

@daantimmer
Copy link

daantimmer commented Dec 3, 2018

I seem to be unable to properly parse the .text section in our map file.
Map file is generated by (arm) gcc.

This is the output that I am getting from a test-run with fixed pre-built .map file + associated linker file:

Memory Map Plugin version 2.2.1 (53614)
Printing configuration

{SAMD20-Release=[0] rom [origin = 0x00000000, length = 0x00040000, used = 0x00040000, unused = N/A, endAddress = N/A]
[1] .text [origin = 0x00000000, length = N/A, used = 0x24244, unused = N/A, endAddress = N/A]
[2] .ARM.exidx [origin = 0x00024244, length = N/A, used = 0x8, unused = N/A, endAddress = N/A]
[3] ram [origin = 0x20000000, length = 0x00007580, used = 0x00007580, unused = N/A, endAddress = N/A]
[4] .relocate [origin = 0x20000000, length = N/A, used = 0x458, unused = N/A, endAddress = N/A]
---- ram [origin = 0x20000000, length = 0x00007580, used = 0x00007580, unused = N/A, endAddress = N/A]
[5] .bss [origin = 0x20000458, length = N/A, used = 0x3208, unused = N/A, endAddress = N/A]
---- ram [origin = 0x20000000, length = 0x00007580, used = 0x00007580, unused = N/A, endAddress = N/A]
[6] .stack [origin = 0x20003660, length = N/A, used = 0x1000, unused = N/A, endAddress = N/A]
---- ram [origin = 0x20000000, length = 0x00007580, used = 0x00007580, unused = N/A, endAddress = N/A]
[7] TOUCH_SAFETY_DATA_LOCATION_region [origin = 0x20007580, length = 0x00000680, used = 0x00000680, unused = N/A, endAddress = N/A]
[8] TOUCH_SAFETY_DATA_LOCATION [origin = 0x20007580, length = N/A, used = 0x670, unused = N/A, endAddress = N/A]
---- TOUCH_SAFETY_DATA_LOCATION_region [origin = 0x20007580, length = 0x00000680, used = 0x00000680, unused = N/A, endAddress = N/A]
[9] FMEA_SAFETY_DATA_LOCATION_region [origin = 0x20007c00, length = 0x00000400, used = 0x00000400, unused = N/A, endAddress = N/A]
[10] FMEA_SAFETY_DATA_LOCATION [origin = 0x20007c00, length = N/A, used = 0x54, unused = N/A, endAddress = N/A]
---- FMEA_SAFETY_DATA_LOCATION_region [origin = 0x20007c00, length = 0x00000400, used = 0x00000400, unused = N/A, endAddress = N/A]
}

When I parse the data for flash/rom data like: .text+.ARM.exidx I get the following graph:
image
(I also can't add the .relocate section because it parses it like RAM only and will set max to 30k.)
What I am missing is the parsing of the maximum value. It currently parses as 0 bytes. (hence the (MAX) .text .ARM.exidx is all the way at the bottom)

When I include the rom section like: .text+.ARM.exidx,rom I'll get the following graph:
image
Which is a workaround-ish because now it does show the maximum value, however it looks ugly as sh--.

The other issues that is happening is that the FMEA_SAFETY_DATA_LOCATION and TOUCH_SAFETY_DATA_LOCATION are parsed like they have 30k of space each, so I can't include them in the .relocate+.bss+.stack calculation, because than the maximum becomes 90k, and not 32k (which is expected: (0x7580 + 0x670+0x400 = 0x8000 = 32k).

For a reference, this is the output from the compiler:

    "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-size.exe" "[redacted].elf"
       text	   data	    bss	    dec	    hex	filename
     148044	   2844	  16904	 167792	  28f70	[redacted].elf
Done executing task "RunCompilerTask".
Using "RunOutputFileVerifyTask" task from assembly "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application\AvrGCC.dll".
Task "RunOutputFileVerifyTask"
            Program Memory Usage 	:	150888 bytes   57,6 % Full
            Data Memory Usage 		:	19748 bytes   60,3 % Full

Where:

  • ROM = text + data ( 148044+2844 = 150888 / 254kb)
  • RAM = data + bss ( 2844 + 16904 = 19748 / 32kb)

In the linker file:

  • ROM = .text + .ARM.exidx + .relocate + TOUCH_SAFETY_DATA_LOCATION + FMEA_SAFETY_DATA_LOCATION ( 148036 + 8 + 1112 + 1648 + 84 = 150888/254kb)
  • RAM = .relocate + .bss + .stack + TOUCH_SAFETY_DATA_LOCATION FMEA_SAFETY_DATA_LOCATION ( 1112 + 12808 + 4096 + 1648 + 84 = 19748/32kb)

If there is anything I should be doing/testing/changing please let me know.

Kind regards,


Edit, if I require to send you the used .ld and .map file, let me know. Because I'll have to remove company sensitive information from the map file first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant