kersing 0 Posted June 29, 2013 Report Share Posted June 29, 2013 Target device PIC16F1824. I'm trying to use the linear data memory for an array (small for now, but might grow) but I'm running into issues. Trivial example code: #include <system.h> void main() { int a; int b[10]@0x2000; int c; a = 1; while (1) { b[0] = a; c = b[0]; porta = a; a++; b[0]++; } } Looking at the pertinent bits of generated map file: Register usage ============== Address Bit Lengh Bit Mask Unique Name Name ------- --------- -------- ----------- ---- 00000020:00000010 main_1_a a 00000022:00000010 main_1_c c 00002000:000000A0 main_1_b b Looking at figure 3-10 of the data sheet, linear memory starting at 0x2000 overlaps the bank 0 addresses 0x20 to 0x6f. So it seems the array uses the same memory used by variables a and c. The TDF file specifies a RegisterGP length 50 at 0020h,2000h so it seems the compiler/linker should know about the overlap? Am I missing a compiler/linker switch or some (source) code magic? Best regards, Jac Quote Link to post Share on other sites
Dave 0 Posted July 2, 2013 Report Share Posted July 2, 2013 Jac, I though this problem was going to be an entry missing from the target descriptor file (TDF) that describes many of the attributes, including memory mapping, but the required data appears to already be there to indicate the overlap. So it must be something else wrong with the linker. Regards Dave Quote Link to post Share on other sites
kersing 0 Posted July 8, 2013 Author Report Share Posted July 8, 2013 Hi Dave, Could I work around the linker issue by modifying the TDF and removing the low (0020h) memory reference to force the linker to use the linear memory or will this not work? Regards, Jac Quote Link to post Share on other sites
Dave 0 Posted July 9, 2013 Report Share Posted July 9, 2013 Jac, Could I work around the linker issue by modifying the TDF and removing the low (0020h) memory reference to force the linker to use the linear memory or will this not work?Please try it, but I suspect that it wont work as you would expect it to. Regards Dave Quote Link to post Share on other sites
kersing 0 Posted July 23, 2013 Author Report Share Posted July 23, 2013 Hi Dave, Tried working around the issue by removing the memory reference but as you suspected this does not solve things. I was looking into using the 16f1455 (16 series with USB) for a project, I've already created a TDF and include file for it, but as USB uses the linear memory that won't work. Any chance the linker will be fixed in the near future? Regards, Jac Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.