Jump to content

Does "rom" Data Go In Program Rom Or Data Ram?


Recommended Posts

Hi

 

I want to use a series of "rom char foo_1[256]" arrays to initialise an EEPROM. When I try to do this with 8 of them, I get this:

 

Executing: "C:\Program Files\SourceBoost\boostc.pic18.exe" flash.c -O1 -W2 -v -t 18F4523 -I boostc_libs_r1_3\libs

BoostC Optimizing C Compiler Version 6.87 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2008 Pavel Baranov

Copyright© 2004-2008 David Hobday

 

Licensed to Mark Murray under Single user Full License for 1 node(s)

Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only

 

 

flash.c

Starting preprocessor: "C:\Program Files\SourceBoost\pp.exe" "C:\Documents and Settings\Mark.GRUMPY\My Documents\My Documents\Flash\flash.c" -i "C:\Program Files\SourceBoost\include" -i boostc_libs_r1_3\libs -d _PIC18F4523 -la -c2 -o flash.pp -v -d _BOOSTC -d _PIC18

 

< Working compile removed >

 

Memory Usage Report

===================

Error: No remaining RAM block (on target) big enough for:

'sprintfbuffer' size:128 bytes

'fonteeprom_5' size:256 bytes

'fonteeprom_6' size:256 bytes

'fonteeprom_7' size:256 bytes

 

RAM available:1536 bytes, used:2412 bytes (157.0%), free:-876 bytes (-57.0%),

Heap size:0 bytes, Heap max single alloc:0 bytes

ROM available:32768 bytes, used:0 bytes (0.0%), free:32768 bytes (100.0%)

 

 

failure

 

Question - why is this overflowing my RAM? I need the data (and a lot more later!) to go into ROM, of which I have PLENTY.

The sprintbuffer is fair game, it is a "static char[128]" array.

The fonteeprom_N items are all "rom char fonteeprom[256] = { ... };"

 

Thanks!

 

M

Link to post
Share on other sites

"rom char fonteeprom[256] = { ... };"

 

This method is not described in the manual and may be copying the array from rom to ram at startup.

 

Have you tried "rom char *fonteeprom[256] = { ... };" i.e. a pointer to your rom data.

 

I have tried

rom char myrom[3] = {1,2,3};
fred = myrom[1];

// From listing file.
rom char myrom[3] = {1,2,3};
0313  3000	  MOVLW 0x00
0314  00BF	  MOVWF main_1_myrom

fred = myrom[1];
0315  083F	  MOVF main_1_myrom, W
0316  00CB	  MOVWF __rom_get_00000_arg_objNumb
0317  3001	  MOVLW 0x01
0318  00CC	  MOVWF __rom_get_00000_arg_idx
0319  2010	  CALL __rom_get_00000
031A  00B4	  MOVWF gbl_fred

0045		label3
0045  3401	  RETLW 0x01
0046  3402	  RETLW 0x02
0047  3403	  RETLW 0x03

and it worked as expected. Data is retrieved from rom into fred. I have only tested with PIC16 though. Maybe it is not ready yet for PIC18.

 

Cheers

 

Reynard

Link to post
Share on other sites
"rom char fonteeprom[256] = { ... };"

 

This method is not described in the manual and may be copying the array from rom to ram at startup.

 

Have you tried "rom char *fonteeprom[256] = { ... };" i.e. a pointer to your rom data.

 

 

Aaaaah!

 

If I do ...

rom char *foo = { 1,2,3 };

... instead of ...

rom char foo[3] = { 1,2,3 };

... it works!

 

Funny, that - I was expecting the compiler to treat the two as equivalent. No worries. :P

 

M

Link to post
Share on other sites

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.

Guest
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...
×
×
  • Create New...