Jump to content
Sign in to follow this  
tobik

Boostc: #pragma Data

Recommended Posts

Good news! Thank you, Pavel.

 

BTW - is it possible to define the address of the EEPROM data inside the #pragma DATA?

 

Example

 

#define EEPROM_ADDR_NAME_1 	 0x00
#pragma DATA 0x2100_de_"Name 1  "

 

would be more comfortable and failsave as

 

#pragma DATA EEPROM_ADDR_NAME_1@0x2100_de_"Name 1  "

 

Regards,

Tobias

Share this post


Link to post
Share on other sites

Yes it will be possible to use DATA pragma for both configuration word, eeprom data and data in code memory.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Sorry my post was misleading. What I want to talk about is a LABEL inside the data pragma which can be further used as reference to the address of this data.

 

Example

#pragma DATA EEPROM_ADDR_NAME_1@0x2100_de_"Name 1"
...
char ch = eeprom_load (DATA EEPROM_ADDR_NAME_1);

 

Of course a label for eeprom data at 0x2100 must be reference address 0x00.

 

Regards,

Tobias

Share this post


Link to post
Share on other sites

Pavel

 

Just tried new #pragma DATA in boostc 1.2 alpha.

 

	#pragma DATA _CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC & _BODEN_ON & _LVP_OFF
#pragma DATA 0x2100, 0x12, 0x34, 0x56, 0x78, "ABCD"

 

DATA _CONFIG ... unknown pragma - no code

DATA 0x2100 ... overlapping user data - but correct code

 

BoostC Optimizing C Compiler Version 1.2 Alpha (for PIC16 architecture)

 

http://www.picant.com/c2c/c.html

Copyright© 2004 Pavel Baranov

Copyright© 2004 David Hobday

 

 

flightlog.c(72): warning: unknown or invalid pragma (ignored)

success

BoostLink Optimizing Linker Version 1.2 Alpha

http://www.picant.com/c2c/c.html

Copyright© 2004 Pavel Baranov

Copyright© 2004 David Hobday

Warning: Overlapping user DATA at address:0x00002100

Warning: Overlapping user DATA at address:0x00002101

Warning: Overlapping user DATA at address:0x00002102

Warning: Overlapping user DATA at address:0x00002103

Warning: Overlapping user DATA at address:0x00002104

Warning: Overlapping user DATA at address:0x00002105

Warning: Overlapping user DATA at address:0x00002106

Warning: Overlapping user DATA at address:0x00002107

Warning: Overlapping user DATA at address:0x00002108

Warning: Overlapping user DATA at address:0x00002100

Warning: Overlapping user DATA at address:0x00002101

Warning: Overlapping user DATA at address:0x00002102

Warning: Overlapping user DATA at address:0x00002103

Warning: Overlapping user DATA at address:0x00002104

Warning: Overlapping user DATA at address:0x00002105

Warning: Overlapping user DATA at address:0x00002106

Warning: Overlapping user DATA at address:0x00002107

Warning: Overlapping user DATA at address:0x00002108

Warning: Overlapping user DATA at address:0x00002100

Warning: Overlapping user DATA at address:0x00002101

Warning: Overlapping user DATA at address:0x00002102

Warning: Overlapping user DATA at address:0x00002103

Warning: Overlapping user DATA at address:0x00002104

Warning: Overlapping user DATA at address:0x00002105

Warning: Overlapping user DATA at address:0x00002106

Warning: Overlapping user DATA at address:0x00002107

Warning: Overlapping user DATA at address:0x00002108

 

Tobias

Share this post


Link to post
Share on other sites
Guest Dave

Tobias,

 

_CONFIG does not appear in the header files, so it needs to be manually defined

 

I guess you are getting the overlapping user code warning because you include the #pragma DATA in a header file that is included in more than one source file.

 

So either put the #pragma DATA in a header file that is include only once, or put it in a single source file (.c).

 

This code works work for me:

#include <system.h>

#define _CONFIG 0x2007

#pragma DATA _CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC & _BODEN_ON & _LVP_OFF
#pragma DATA 0x2100, 0x12, 0x34, 0x56, 0x78, "ABCD"

void main()
{
}

 

 

Regards

Dave

Share this post


Link to post
Share on other sites

Dave,

 

you are right about _CONFIG is undefined. I did copy and paste it from the boostc.html documentation file. That should be updated. Note the missing "," behind _CONFIG too.

 

The defines are in my main C file. Not in a header. It is not included twice. I double checked that. And variables from this file are not reported as redefined too. Please can you check that again?

 

Regards,

Tobias

Share this post


Link to post
Share on other sites

You need to use comma after adress. The fromat is:

 

#pragma DATA <addr>, <data>, <data>,...

where:

<addr>  address on dec or hex form
<data>  data in hex or dec or string form

 

(BoostC 1.2 update includes this info in BoostC help file)

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Pavel,

 

BoostC 1.2 help:

 

//Set PIC16 configuration word
#pragma DATA _CONFIG _HS_OSC & _WDT_OFF & _LVP_OFF
...
//Put some data into eeprom
#pragma DATA 0x2100, 0x12, 0x34, 0x56, 0x78, "ABCD"

 

1. _CONFIG must be user defined - so better avoid it in the example.

2. The comma after _CONFIG is missing.

3. The linker generates "Overlapping user DATA at address:0x00002100" warnings.

But beside the warnings the data make it into to LST file.

 

Regards,

Tobias

Share this post


Link to post
Share on other sites
Guest Dave

Tobias,

 

The defines are in my main C file. Not in a header. It is not included twice. I double checked that. And variables from this file are not reported as redefined too. Please can you check that again?

 

If you still have the overlapping user data problem, please email the complete project to me: dave@picchip.com

 

Regards

Dave

Share this post


Link to post
Share on other sites
1. _CONFIG must be user defined - so better avoid it in the example.

2. The comma after _CONFIG is missing.

You are right. I fixed the error in documentation and updated BoostC 1.2 update file.

 

Regards,

Pavel

Share this post


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...
Sign in to follow this  

×
×
  • Create New...