I'm new to the S12X and I'm currently generating code from Matlab Simulink for use on an S12X microcontroller. The problem is it generates a function which is larger than a flash-page. Initially I got an error the code could not be located as a result that the function did not fit a page. Then I adapted the prm file to use global addressing on the entire flash:
S12X_FLASH = READ_ONLY 0x788000'G TO 0x7F3FFF'G;
DEFAULT_ROM INTO S12X_FLASH;
Well, this compiles, links and runs... However it still does not run the large (the one larger as a page) function correctly. The function is called at the correct address but it fails while executing the function. When I manually adapt the function and decrease the size to a smaller one (so it fits within a page), other assembly is generated and it runs all fine.You can see the difference in the attachments.
Not adapted it executes (Dissasembly_Normal.JPG):
When it executes the JSR-command it hangs up.
Adapted (small size function, see Dissasembly_Adapted.JPG):
Here it loads the correct page normally as I would expect and this runs fine
The thing is, it concers generated code so I'm not able to adapt the file/function. Does anyone knows what's going on and how to fix it?