Hello fanziyu,
interesting topic. Generally yes, if all conditions are the same, you should get the same result.
From your picture:
- please ignore the first line starting with S0 - it is just a header - no relationship to MCU memory content.
- The initial part of code (approx. 0xC000~0xC050) is identical - that will be most probably startup code.
- The next code looks quite similar with differences at dedicated places - it looks like some offset in addresses. For example 0887AA 0887AF 08 97B9 vs 08ACA1 08ACA6 08ACB0.
If you would like to investigate, please compare the map files and check whether variables are on the same places in memory.
Of course, as first you should compare the content of linker files and check whether you have the same compiler and linker settings.
For example: The linker file may contain some constant names in ENTRIES section. These constants will be not excluded by linker as unused (default behavior). This may be also confirmed in map file where all unused variables/constants are listed in one of the sections.
I hope it helps you.
Best regards
RadekS