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

C167: HLarge does not work

Hi all,

I work with ST10F269 cpu for 5 years and used HCompact memory model all the time. Everything worked as intended. Now my project does not fit HCompact anymore and I've switched to HLarge. It compiles, but does not work. The same program which works fine when compiled with HCompact does not work (jumps to nowhere) if I compile it by changing ONLY the memory model setting to HLarge.

Could anybody give a direction please?

Thanks!

  • Now my project does not fit HCompact anymore and I've switched to HLarge

    That was likely not the best possible reaction at that point. Switching the memory model for the entire program like that will make it bigger and slower. You probably shouldn't have gone to HCompact in the first place, for the same reason. Your program would be smaller now if you hadn't enlarged it so by going to HCompact. The usual trick it to stick with the smallest memory model you can possibly manage, and handle the excess by moving some objects into bigger memory spaces.

    It compiles, but does not work.

    And that's really you can say about how it failed: "does not work"?

  • Switching the memory model for the entire program like that will make it bigger and slower. You probably shouldn't have gone to HCompact in the first place, for the same reason.

    Agree, but everything has been done by my predecessor, and I have never had time to rework the whole project...

    And that's really you can say about how it failed: "does not work"?

    As I said, somewhere at the beginning it makes a jump to a strange address. Of course, I will dig in and do more investigation, but my point is that I thought the changing the memory model from HCompact to HLarge (at least) should not break it...

    Thanks!

  • I thought the changing the memory model from HCompact to HLarge (at least) should not break it...

    And in all likelihood it didn't. It was quite probably broken already, but just so happened to work nevertheless.

    Less-than-careful use of pointer voodoo, particularly any casts that modify memory space qualifiers, will do that to your code rather easily. In the case at hand, since it's the size of function pointers you changed, the effected pointers would probably be function pointers.

  • Thank you, Hans-Bernhard!

    Of course, you were right - functions' pointers were the culprits. 99% of code of the project is written in C, but a few functions in Assembly. One of them was hard-coded as NEAR... Now everything works.

    Thanks again!