Jump to content
Sign in to follow this  
fred

Generate Data File

Recommended Posts

Would be handy if there is a simple way within the IDE\compiler to create a hex data file which can be loaded in EEPROM and is part of the project.

 

a little option which makes it possible to dump an array in a file could do the job

 

I´m pretty new in all this so maybe I oversee a very simple alternative which is already available but now I´m using\need another ´normal´ compiler to do this.

Share this post


Link to post
Share on other sites

Fred,

Would be handy if there is a simple way within the IDE\compiler to create a hex data file which can be loaded in EEPROM and is part of the project.

 

a little option which makes it possible to dump an array in a file could do the job

 

I´m pretty new in all this so maybe I oversee a very simple alternative which is already available but now I´m using\need another ´normal´ compiler to do this.

You can already do this form within your source code!

Is this not good enough ???

#pragma DATA _EEPROM, 12, 24, 56

 

Regards

Dave

Share this post


Link to post
Share on other sites

well, I'm back to my request

 

It looks like I can't do this in a simple way using #pragma DATA

 

I divided my eeprom in several segments which I want to fill with default data.

 

Since all addresses are relative to _EEPROM and it looks like it´s not possible to do this.

example (which is not possible now)

#define SEG1 0x0
#define SEG2 0x10
#define SEG3 0x80
#pragma DATA  _EPROM+SEG1, 1, 1, 1, 1, 1, 1, 1
#pragma DATA  _EPROM+SEG2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
#pragma DATA  _EPROM+SEG3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3

 

Because I prefer to get this data included in my project hex file I did make a little vb program which generates a eeprom_data.h file which I include in my main.c

The generated eeprom_data.h file contains the pragma source to initialize the complete eeprom databuffer to it's defaults

like

#pragma DATA _EEPROM\
0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2\
2,2,2,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\
0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0\

etc.

 

this doesn't work eather while in my current project the eeprom data buffer is 255 words. The above contruction will fail because of the line buffer size limitation of the (pre)compiler!! <_<

 

For the time being I will generate a separate hex data file for my programmer but I still would prefer to have a integrated solution for my project! (and wqithout the need of an extra compiler to generate a file)

Share this post


Link to post
Share on other sites

Why not just use teh eeprom commands and write/read to it normally?

 

I just simply make a seperate program to fill statics.

Share this post


Link to post
Share on other sites

I don't know if I understand you correctly.

 

If it's a program within my project (.hex) file it's not an option for me.

It will use extra code and constants will take space twice ):

Once as constants within my code and once as static EEPROM data. I only want to program static data in my eeprom and not code aswell to fill it.

 

If it's possible to program the pic in two steps (1st code to program the eeprom, 2nd to load the final code and leave the eeprom memory untouched) it would be an option. I have to check my programmer software for that but I thought this isn't possible. Don't think this is very handy however and will probably stick to my '3rd party' compiler to create a data hex file. This is pretty easy but again I don't think it would be very preferable (hm, is this English..<_< ) to have a more integrated solution which can do it all.

 

This would enable an easy way to fill the eeprom data aswell into the debuggers eeprom data block. As far as I know it's not possible (yet) to initialize this with static data used by the program

Share this post


Link to post
Share on other sites
If it's possible to program the pic in two steps (1st code to program the eeprom, 2nd to load the final code and leave the eeprom memory untouched) it would be an option. I have to check my programmer software for that but I thought this isn't possible.

 

 

The PIC device programming specifications do allow the EEPROM and program memeory to be programmed seperately.

It all depends whether your programmer impliments this.

Share this post


Link to post
Share on other sites

What i ment was to write two programs/projects,

the first one whos sole purpose is to write the static data into your eeprom.

 

The second being your normal program that acesses the data.

 

This way you avoid any actual programmer issues, it requires a bit extra

coding on your part for the second program but accomplishes the task.

Share this post


Link to post
Share on other sites

well I'm using IC-prog which doesn't allow a two step programming (eeprom data, coding)

IC-prog has the abillity to also load a hex eeprom data file and program them both in 1 step. So I think my solution in generating such datafile using vb or vcc is more easy and flexible. (of course this requires an extra development environment..!)

 

Nevertheless all these solutions are not ideal and bypassing the lack of an integrated solution in sourceboost\IDE for ease and consitency.

 

So my "enhancement request" is still valid I think and includes an important one also: the possibility of loading the same static data in the debugger EEPROM data block aswell to get a representative simulation!!

Share this post


Link to post
Share on other sites

@emte

 

 

(1) What I understand from you:

1.1 create the "normal program"

1.2 create a program which purely fills the EEPROM with the default data

 

1.A program 1.2 into the PIC to fill the eeprom with data

1.B program 1.1 into the PIC without touching the EEPROM area

 

IC-PROG (the programmer software I use) initializes the eeprom data buffer either with the content of a separate hexfile or with a value you can specify and then programs the complete PIC

 

 

(2) What I do:

2.1 see 1.1/

2.2 create a hex file with the default EEPROM data using a regular c or vb compiler

 

2.A Load both hex files 2.1 en 2.2 in programmer and flash the PIC

 

 

So where do we misunderstand eachother..? <_<

 

 

 

 

@everybody

 

What I would like to have in my project source file(s) is (for example)

#pragma DATA _EEPROM@0x10 "string1", 'q', 0x0

#pragma DATA _EEPROM@0x20 "string2", 'q', 0x0

which should also be loaded in the debuggers EEPROM data area when starting the debugger

 

now only #pragma DATA _EEPROM is supported which doesn't make it possible to specify the complete EEPROM data content...! (as far as I understand ;) )

Share this post


Link to post
Share on other sites

fred,

What I would like to have in my project source file(s) is (for example)

#pragma DATA _EEPROM@0x10 "string1", 'q', 0x0

#pragma DATA _EEPROM@0x20 "string2", 'q', 0x0

which should also be loaded in the debuggers EEPROM data area when starting the debugger

 

now only #pragma DATA _EEPROM is supported which doesn't make it possible to specify the complete EEPROM data content...!  (as far as I understand  <_< )

This code is for a PIC16F874, I know its not ideal.

//#define _EEPROM 	0x2100 // already defined in header file
#define _EEPROM10 	0x2110
#define _EEPROM20 	0x2120
#define _EEPROM30 	0x2130
#define _EEPROM40 	0x2140

#pragma DATA _EEPROM, 3, 2, 1
#pragma DATA _EEPROM10, 1, 2, 3
#pragma DATA _EEPROM20, 5, 6, 7
#pragma DATA _EEPROM30, 8, 9, 10
#pragma DATA _EEPROM40, 11, 12, 13

 

Regards

Dave

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...