C251 linker/mapping

Hello,
My code has a problem with I2C. after study, I found it related to link sequence. It include 2 modules, say Module1 and Module2. If I add some dummy code in Module1 to make Module1 size is bigger than Module2, it works correctly. Then I check the "map" file and found Module1 linking location is before Module2. On the contrary, If I add some dummy code to Module2 to make Module2 size is bigger than Module1, it works incorrectly. The total code size is same as case 1, the only difference is that in the "map" file Module2 code location is before Module1. Anybody has any idea?
Thanks.

Parents
  • The size difference almost certainly isn't the real reason for this problem. The order of the two modules in the output code is a lot more likely to be the root cause.

    OTOH, correctly written code shouldn't depend on placement in memory. Are you sure you're not getting any other warning messages from the linker?

    And what is that "problem with I2C", anyway? My crystal ball's in for maintenance, so you'll have to explain more about the actual symptoms you see.

Reply
  • The size difference almost certainly isn't the real reason for this problem. The order of the two modules in the output code is a lot more likely to be the root cause.

    OTOH, correctly written code shouldn't depend on placement in memory. Are you sure you're not getting any other warning messages from the linker?

    And what is that "problem with I2C", anyway? My crystal ball's in for maintenance, so you'll have to explain more about the actual symptoms you see.

Children
More questions in this forum