This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Display padding in Structs

Hey Community

I look for a method to export all the details of existing structures (location of the fields and padding).

The goal of this is to share variables of our software and their location with other teams, so they can validate the software by reading internal variables or modify control parameters for some other tests.

Currently I am looking the .map file in order to know where the structures and variables are located. I have an Excel file where I put all information manually about the fields of the structures, and with a macro I scan the .map file to export the base address of structs and the variables.

I would like to automatize this. Maybe there exists a configuration, so that the compiler has an output file where it is nicely visible or extractable by another script. Analyse the .map file in order to export the base address of all variables and structures should not be the problem, also not the padding between the variables / structs. But how extract the paddin and alignement inside a structure?  And how extract the existing fields of a structure?

Is there a way to do/know this without looking the header files?

 
I know the good approach should be to define the structures in a way, to have no incertitude about the packing and padding. The problem is that this was not done at the start of the project, also not all of the team members care about such “details” as padding and alignment and the general knowledge of the compiler is not so well (me including).

Details about the system:

IDE-Version:
µVision V5.20.0.0
Copyright (C) 2016 ARM Ltd and ARM Germany GmbH. All rights reserved.


Tool Version Numbers:
Toolchain:        MDK-ARM Standard Cortex-M only: 2 user(s)  Version: 5.20
Toolchain Path:    C:\Keil_v5\ARM\ARMCC\Bin
C Compiler:         Armcc.exe        V5.06 update 2 (build 183)
Assembler:          Armasm.exe        V5.06 update 2 (build 183)
Linker/Locator:     ArmLink.exe        V5.06 update 2 (build 183)
Library Manager:    ArmAr.exe        V5.06 update 2 (build 183)
Hex Converter:      FromElf.exe        V5.06 update 2 (build 183)
CPU DLL:               SARMCM3.DLL          V5.20
Dialog DLL:         DARMCM1.DLL          V1.14.0.0
Target DLL:             Segger\JL2CM3.dll      V2.99.20.0
Dialog DLL:         TARMCM1.DLL          V1.10.0.0