Jump to content
kersing

Fsr Memory & Paged Memory Overlap?

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×