Searching \ for '[PIC] sdcc: eeprom definition' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=eeprom
Search entire site for: 'sdcc: eeprom definition'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] sdcc: eeprom definition'
2010\11\20@141849 by KPL

picon face
Hi,

I'm trying to learn sdcc for pic, on linux. I have almost no
experience using C at all, so probably missing something very simple.

There must be a way to define contents of EEPROM that should be
programmed when the code is being programmed into chip. I do not see
clear description in sdcc manual, probably that's something that
should be obvious for a C user? Seems like that should be done using
preprocessor commands, but those are not clear to me yet.
Can anybody direct me to some description or example?

Currently I'm using pic16f88 and pickit2.

-- KP

2010\11\21@202242 by Xiaofan Chen

face picon face
On Sun, Nov 21, 2010 at 3:18 AM, KPL <spam_OUTkpl.listesTakeThisOuTspamgmail.com> wrote:

> I'm trying to learn sdcc for pic, on linux. I have almost no
> experience using C at all, so probably missing something very simple.

I do not use sdcc. But they have a mailing list, fairly active.
You can try that.
https://lists.sourceforge.net/lists/listinfo/sdcc-user

On the other hand, I think sdcc for PIC is not that good
from what I read. sdcc for 8051 is pretty good though.


-- Xiaofa

2010\11\22@012128 by KPL

picon face
>
> I do not use sdcc. But they have a mailing list, fairly active.
> You can try that.
> https://lists.sourceforge.net/lists/listinfo/sdcc-user

I searched their archives previously and did not find required info.

>
> On the other hand, I think sdcc for PIC is not that good
> from what I read. sdcc for 8051 is pretty good though.

Seems like that, but many people have done their projects successfully
(It's just a hobby for me) and not a lot of other tools are available
in linux.

-- KP

2010\11\22@013831 by Oli Glaser

flavicon
face
On 20/11/2010 19:18, KPL wrote:
> Hi,
>
> I'm trying to learn sdcc for pic, on linux. I have almost no
> experience using C at all, so probably missing something very simple.
>
> There must be a way to define contents of EEPROM that should be
> programmed when the code is being programmed into chip. I do not see
> clear description in sdcc manual, probably that's something that
> should be obvious for a C user? Seems like that should be done using
> preprocessor commands, but those are not clear to me yet.
> Can anybody direct me to some description or example?
>
> Currently I'm using pic16f88 and pickit2.
>

I don't know if it's the same with Linux, but on Windows using the PicKit2 software you can program the EEPROM directly (on it's own if you want) by just typing the values required into the EEPROM data window, then hitting write (untick the "enabled" box next to the program memory window if you don't want to program that too)

2010\11\22@015122 by KPL

picon face
I am using pk2cmd command line tool for pickit2, which has options to
program only code space or eeprom, but it fails verification always if
option other than "delete/program all" is selected, it complains about
some particular address when data is not as expected. I tried with
different chips with the same result.
The very least thing I was hoping to achieve was that eeprom would not
be erased at every code change.

>
> I don't know if it's the same with Linux, but on Windows using the
> PicKit2 software you can program the EEPROM directly (on it's own if you
> want) by just typing the values required into the EEPROM data window,
> then hitting write (untick the "enabled" box next to the program memory
> window if you don't want to program that too)
>


-- KP

2010\11\22@024354 by Oli Glaser

flavicon
face
On 22/11/2010 06:51, KPL wrote:
> I am using pk2cmd command line tool for pickit2, which has options to
> program only code space or eeprom, but it fails verification always if
> option other than "delete/program all" is selected, it complains about
> some particular address when data is not as expected. I tried with
> different chips with the same result.
> The very least thing I was hoping to achieve was that eeprom would not
> be erased at every code change.
>


Hmmm, never used the pk2cmd tool - I notice there is no GUI based PicKit2 software for Linux.
In any case, the pk2cmd sounds like it should be able to do what you want here - not sure why the verification would not work unless you only program all at once - though I think it's likely to be something you are doing wrong, as I can't imagine a bug like that staying around for very long..
Have you checked the pk2cmd manual (I guess you have) to see if it has any relevant info?
I take it you have the PIC setup okay, with bypass caps and so on?

Sorry can't be of much more help, I only know how to do it on Windows.. :-)
I may download and have a look at the pk2cmd on here when I have a moment - will get back to you if I discover anything.
If not, pretty sure someone else here will know more and will chip in soon.

2010\11\22@031156 by Michael Watterson

face picon face
 On 22/11/2010 01:22, Xiaofan Chen wrote:
> On Sun, Nov 21, 2010 at 3:18 AM, KPL<.....kpl.listesKILLspamspam@spam@gmail.com>  wrote:
>
>> I'm trying to learn sdcc for pic, on linux. I have almost no
>> experience using C at all, so probably missing something very simple.
> I do not use sdcc. But they have a mailing list, fairly active.
> You can try that.
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
> On the other hand, I think sdcc for PIC is not that good
> from what I read. sdcc for 8051 is pretty good though.
>
>
SDCC for PIC is a compiler project, not yet a PIC tool, use Micro-chip's free version of HiTech C,
or Pascal or JAL.  (JALV2 does 10F, 12F, 16F, 18F with much easy to read libraries)

A PIC is not a good starting point to learn C.

There are a couple of other decent C for PIC 16F/18F that have demo versions. I know of no "free" C for PIC that lets you sensibly do real projects

2010\11\22@032507 by KPL

picon face
> SDCC for PIC is a compiler project, not yet a PIC tool, use Micro-chip's
> free version of HiTech C,
> or Pascal or JAL.  (JALV2 does 10F, 12F, 16F, 18F with much easy to read
> libraries)
>
> A PIC is not a good starting point to learn C.
>
> There are a couple of other decent C for PIC 16F/18F that have demo
> versions. I know of no "free" C for PIC that lets you sensibly do real
> projects.


The keyword here is "linux" :)

I have been learning C many years ago, just never used it for real things.

-- KPL

2010\11\22@042604 by Xiaofan Chen

face picon face
On Mon, Nov 22, 2010 at 4:25 PM, KPL <kpl.listesspamKILLspamgmail.com> wrote:
>
> The keyword here is "linux" :)
>
> I have been learning C many years ago, just never used it for real things..

HiTech PICC and Jal work under Linux.

Now they even have MPLAB X for Linux (but no PICkit 2 support inside
MPLAB X yet ).
http://ww1.microchip.com/downloads/mplab/X_Beta/index.html


-- Xiaofa

2010\11\22@055135 by Michael Watterson

face picon face
 On 22/11/2010 08:25, KPL wrote:
>> SDCC for PIC is a compiler project, not yet a PIC tool, use Micro-chip's
>> free version of HiTech C,
>> or Pascal or JAL.  (JALV2 does 10F, 12F, 16F, 18F with much easy to read
>> libraries)
>>
>> A PIC is not a good starting point to learn C.
>>
>> There are a couple of other decent C for PIC 16F/18F that have demo
>> versions. I know of no "free" C for PIC that lets you sensibly do real
>> projects.
>
> The keyword here is "linux" :)
>
> I have been learning C many years ago, just never used it for real things..
>
Linux or PIC or C?

PIC is irrelevant to C on Linux

JALV2 is on Linux and Windows.

I'm not clear on your aims?
Learning C
Learning to use PIC
Doing a PIC based Project
Wanting to use C on PIC via Linux Development? (Must already be expert in C, Linux and PIC)
16F or 18F?

SDCC is not a good way to learn C or Program PIC.

2010\11\22@062926 by KPL

picon face
Ok, in this case there was quite specific problem in my question, but
thread went a bit off-topic.
Sdcc itself was not the root of a problem, code itself works fine. I
do not think I will anytime soon get to the limitations of sdcc.

My aims? Probably a bit of all mentioned - spend my free time using
things I already have or can use for free, and learning things along
the way. Much better than watching TV, even if nothing particularily
usefull comes out.


On Mon, Nov 22, 2010 at 12:51 PM, Michael Watterson <.....mikeKILLspamspam.....radioway.org> wrote:
{Quote hidden}

>

2010\11\22@064829 by Matt Callow

flavicon
face
On 22 November 2010 22:29, KPL <EraseMEkpl.listesspam_OUTspamTakeThisOuTgmail.com> wrote:
> Ok, in this case there was quite specific problem in my question, but
> thread went a bit off-topic.
> Sdcc itself was not the root of a problem, code itself works fine. I
> do not think I will anytime soon get to the limitations of sdcc.
>
> My aims? Probably a bit of all mentioned - spend my free time using
> things I already have or can use for free, and learning things along
> the way. Much better than watching TV, even if nothing particularily
> usefull comes out.

If you want to program the EEPROM from Linux, you can use pk2cmd -
I've done it before.
'All' you need to do is create a hex file for the EEPROM data, and
find the correct address for the EEPROM data in the hex file.
(Also, I think you need to pad the EEPROM data in the hex file to 16 bits?)

If you need more info, I'll see if I can find the old Makefile I used for this.

Mat

2010\11\22@075953 by Adam Field

flavicon
face
>> On the other hand, I think sdcc for PIC is not that good
>> from what I read. sdcc for 8051 is pretty good though.
>>
>>
> SDCC for PIC is a compiler project, not yet a PIC tool, use Micro-chip's
> free version of HiTech C,
> or Pascal or JAL.  (JALV2 does 10F, 12F, 16F, 18F with much easy to read
> libraries)
>
> A PIC is not a good starting point to learn C.
>
> There are a couple of other decent C for PIC 16F/18F that have demo
> versions. I know of no "free" C for PIC that lets you sensibly do real
> projects.

I will speak up in defense of SDCC. I am now, however, a user of C18.
But I did use SDCC successfully on my own projects for PIC16 and
PIC18. I did give up on C for 16F and learned assembly only because of
timing issues, not because SDCC produced bad or buggy code.
Unfortunately, I can't answer the OP's question but I'm sure he can
modify the hex file before programming.

2010\11\22@082343 by KPL

picon face
>
> I will speak up in defense of SDCC. I am now, however, a user of C18.
> But I did use SDCC successfully on my own projects for PIC16 and
> PIC18. I did give up on C for 16F and learned assembly only because of
> timing issues, not because SDCC produced bad or buggy code.
> Unfortunately, I can't answer the OP's question but I'm sure he can
> modify the hex file before programming.

Most probably will have to add few lines to makefile, so when burning
it would first download eeprom contents to a file, then burn it back
together with code. Probaly that way it would not fail verification.

-- KP

2010\11\22@203723 by Jason White

picon face
>> There must be a way to define contents of EEPROM that should be
>> programmed when the code is being programmed into chip.

Ive used sdcc for a while , as far as I know they do not exist. you best bet
in my mind would be to paste in whatever data you need in the eeprom into
piklab (The only linux microcontroller IDE I know of), after reading the
chip all data fields are editable so you could paste whatever you want into
the data EEPROM field and hit "program" and that generally will cover most
eeprom needs. Ive got no idea how to program eeprom if your just using the
command line or running a wine emulation of mplab.

anyways it sounds like a good opportunity to suggest some decent
improvements for sdcc (though, sdcc is a c compiler, not a eeprom
programmer)


On Sat, Nov 20, 2010 at 2:18 PM, KPL <kpl.listesspamspam_OUTgmail.com> wrote:

{Quote hidden}

>

2010\11\23@002247 by Christopher Head

picon face
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 22 Nov 2010 20:37:22 -0500
Jason White <@spam@whitewaterssoftwareinfoKILLspamspamgmail.com> wrote:

{Quote hidden}

You can probably use __code and __at to achieve the desired result, the
same way you do for configuration fuses, by specifying as the parameter
to __at the address that the HEX file needs to contain to signal to the
programming tool that you're talking about EEPROM.

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: GnuPT 2.7.2

iEYEARECAAYFAkzrT58ACgkQXUF6hOTGP7eRvQCfW3mgd1h+dxOzt28V9qr6lEHC
sK4An09OFRs+6HGu9Z2u7O2YSD9JV2gy
=qa45
-----END PGP SIGNATURE-----

2010\11\23@003135 by Christopher Head

picon face
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 22 Nov 2010 20:37:22 -0500
Jason White <KILLspamwhitewaterssoftwareinfoKILLspamspamgmail.com> wrote:

{Quote hidden}

You can probably use __code and __at to achieve the desired result, the
same way you do for configuration fuses, by specifying as the parameter
to __at the address that the HEX file needs to contain to signal to the
programming tool that you're talking about EEPROM.

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: GnuPT 2.7.2

iEYEARECAAYFAkzrT3oACgkQXUF6hOTGP7fOyQCcCxZuo2bIa2SLwZwWtpRFpY9i
vN0An22KUxgBaREbjRqzZsk1i2PUkshy
=g3Gv
-----END PGP SIGNATURE-----

2010\11\23@012926 by William \Chops\ Westfield

face picon face

On Nov 21, 2010, at 10:21 PM, KPL wrote:

> not a lot of other tools are available in linux.

cc5x runs pretty well under Wine...  I'd expect most other "command  line"
compilers to do so as well...
I wrote some shell scripts to make the "wine" part invisible.

#!/bin/bash
echo $0
case $0 in
    */cc5x)
     app=~/Applications/WineApps/cc5x/cc5x.exe
     if [ "x$*" != "x" ]; then
       config=-IC:cc5x
       args=$*
     fi;;

    */mpasm)
     app=~/Applications/WineApps/mpasm
     if [ "x$*" != "x" ]; then
       config=
       args=$*
     fi;;



    mplink)
     app=~/Applications/WineApps/cc5x/cc5x.exe
     config=-IC:cc5x
     args=$*;;
esac
echo win $app $config $args
/sw/bin/wine $app $config $args

2010\11\23@013402 by KPL

picon face
>
> Ive used sdcc for a while , as far as I know they do not exist. you best bet
> in my mind would be to paste in whatever data you need in the eeprom into
> piklab (The only linux microcontroller IDE I know of), after reading the
> chip all data fields are editable so you could paste whatever you want into
> the data EEPROM field and hit "program" and that generally will cover most
> eeprom needs. Ive got no idea how to program eeprom if your just using the
> command line or running a wine emulation of mplab.
>
> anyways it sounds like a good opportunity to suggest some decent
> improvements for sdcc (though, sdcc is a c compiler, not a eeprom
> programmer)

Yes, I know that.
But when using asm, there is a directive DE, which seems to be meant
for this. I was hoping there is a way to implement something similar
using C, so I did not have to mess with separate data definitions for
eeprom. I even tried using that as an asm include, but it's not quite
clear about location where that should be included.
I tried sdcc directives for absolute adressing, but those are not
meant for this either.
When downloading PIC contents using pk2cmd, I can see those eeprom
bytes in hex file, but do not yet see a way to set them easily.
Let's leave it now as it is, since I found I had missed a parameter
for pk2cmd, -Z, which seem to help not to overwrite eeprom.
Sometimes verification still fails, but then works without complaints
again. Do not know the reason.

-- KP

2010\11\23@015715 by KPL

picon face
>
> You can probably use __code and __at to achieve the desired result, the
> same way you do for configuration fuses, by specifying as the parameter
> to __at the address that the HEX file needs to contain to signal to the
> programming tool that you're talking about EEPROM.

Yes I tried that, but __code tries to produce data in code memory, and
complains that this address is out of allowed region or something like
that.
I did not find eeprom address in pic16f88 manuals, but it appearded in
hex file downloaded from pic, and google search gave me the same
address, 0x2100.

-- KP

2010\11\23@060020 by ivp

face picon face
> I did not find eeprom address in pic16f88 manuals, but it appearded
> in hex file downloaded from pic, and google search gave me the same
> address, 0x2100.

MPLAB and the .inc file often have additonal information

For example, if you look up DE in the MPLAB Assembler Help
you'll find

Most PIC1x MCUs 0x2100
PIC18x MCUs 0xF00000
PIC16F19xx MCUs 0xF000

Joe

*
*
**********
Quality PIC programmers
http://www.embedinc.com/products/index.ht

2010\11\23@063014 by KPL

picon face
>
> MPLAB and the .inc file often have additonal information
>
> For example, if you look up DE in the MPLAB Assembler Help
> you'll find
>
> Most PIC1x MCUs 0x2100
> PIC18x MCUs 0xF00000
> PIC16F19xx MCUs 0xF000
>

Actually I found that address is mentioned in DE description in mpasm
manual too.

-- KP

2010\11\23@081719 by Olin Lathrop

face picon face
KPL wrote:
> I did not find eeprom address in pic16f88 manuals,

That kind of information is usually in the programming spec, not the
datasheet.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

More... (looser matching)
- Last day of these posts
- In 2010 , 2011 only
- Today
- New search...