Hello everyone!
I am working on a project in Keil uVision 4 using a custom 8051W ASIC (8K in size) and found an issue when working with the large code rom size.
We were originally working with the compact model but found some of our functions at the time were over 2K so we had switched to the large model, which allowed for larger functions. Since then, we've optimized the code a lot and the functions have been all under 2K in size. We did have some issues with the startup of the chip though and, after lots of tests, determined the root cause to be because of this large model.
Keil describes the difference shown below (taken from: http://www.keil.com/support/man/docs/c51/c51_rom.htm)
Compact - CALL instructions are coded as LCALL. JMP instructions are coded as AJMP within a function. The size of a function must not exceed 2 KBytes. The entire program may, however, comprise a maximum of 64 KBytes. The type of application determines whether or not ROM (COMPACT) is more advantageous than ROM (LARGE). Any code space saving advantages in using ROM (COMPACT) must be empirically determined.
Large - CALL and JMP instructions are coded as LCALL and LJMP. This allows you to use the entire address space without any restrictions. Program size is limited to 64 KBytes. Function size is also limited to 64 KBytes.
Looking at the above description, I can see that the 2K function limit is a clear difference between the two but also that the large code rom uses LJMP rather than AJMP, which I would assume would make using the large code rom size advantageous in that respect, though this would take up more code space as a result (since the addressing is longer due to the LJMP).
However, when I use the large code rom size, I'm having issues with startup (ie the chip is unable to write to our ESFR registers at -40 degC). I'm having trouble seeing any unintentional consequences of selecting the large code rom but clearly, something is at work as it works fine using the compact code so I thought I'd come to the experts!
Can anyone shed any light on what could potentially be causing these issues? Any help would be appreciated. Thanks!