Vaclav Peroutka | 3 Dec 2007 10:09
Picon
Favicon

USB compilation for PIC16 - strange errors

Hello all,

I tried to compile the USB code from N&V June 2006 ( http://www.nutsvolts.com/media-files/113/USB.zip )
and got following messages:

D:\V\USB-test\PICHID>make
sdcc -I. -I\include --vc --fstack --denable-peeps --optimize-goto --optimize-cmp --optimize-df
--obanksel=9 --opt-code-s
ize --fommit-frame-pointer -mpic16 -pp18f2550  -c main.c
at 1: warning 117: unknown compiler option '--fstack' ignored
sdcc -I. -I\include --vc --fstack --denable-peeps --optimize-goto --optimize-cmp --optimize-df
--obanksel=9 --opt-code-s
ize --fommit-frame-pointer -mpic16 -pp18f2550  -c usb.c
at 1: warning 117: unknown compiler option '--fstack' ignored
usb.c(352) : error 47: indirections to different types assignment
from type 'unsigned-char const-[32]  code-code* '
to type 'unsigned-char generic* '
usb.c(500) : error 47: indirections to different types assignment
from type 'const-unsigned-char [4]  code-code* '
to type 'unsigned-char generic* '
usb.c(502) : error 47: indirections to different types assignment
from type 'const-unsigned-char [14]  code-code* '
to type 'unsigned-char generic* '
usb.c(504) : error 47: indirections to different types assignment
from type 'const-unsigned-char [32]  code-code* '
to type 'unsigned-char generic* '
usb.c(693) : error 47: indirections to different types assignment
from type 'volatile-unsigned-char [32]  near* '
to type 'unsigned-char generic* '
make: *** [usb.o] Error 1
(Continue reading)

Raphael Neider | 3 Dec 2007 12:50
Picon

Re: USB compilation for PIC16 - strange errors

Hi Vaclav,

> at 1: warning 117: unknown compiler option '--fstack' ignored

Just remove --fstack from the compiler flags OPTS in Makefile. You will
also want to remove -t 128 from the gplink command line, as SDCC
provides the symbol _stack in the libraries; gplink's stack would
collide with it...

> usb.c(352) : error 47: indirections to different types assignment
> from type 'unsigned-char const-[32]  code-code* '
> to type 'unsigned-char generic* '

and following (467!, 477!, 486! (these are not warned about!), 500, 502,
504): You need to explicitly cast the right hand side to (code byte *)
for now. The problem here is that casts from pointer to array type to
pointer to simple type are not implicitly allowed.

> usb.c(693) : error 47: indirections to different types assignment
> from type 'volatile-unsigned-char [32]  near* '
> to type 'unsigned-char generic* '

Watch out: This one wants to be cast to (data byte *) instead!

> Can somebody help me what do these messages mean ? How to correct them ?

The above measures will allow you to build the project, but manual
inspection of the code generated for usb.c, l.309 revealed that there is
severe bug in the code generator: instead of just reading
SetupPacket.wValue1 (offset 3), the generated code overwrites
(Continue reading)

Vaclav Peroutka | 3 Dec 2007 13:59
Picon
Favicon

Re: USB compilation for PIC16 - strange errors

Hi Raphael,

thank you very much for your quick response! I corrected the lines as you suggested and it looks much better.

I have following output (maybe some problems with gputils) - there is EEPROM memory. I noticed it in some
other projects as well so it is not a bug of USB code or SDCC itself.

d:\v\USB-test\PICHID>make
sdcc -I. -Id:\v\sw\sdcc\include --vc --denable-peeps --optimize-goto --optimize-cmp --optimize-df
--obanksel=9 --opt-code-size --fommit-frame-pointer -mpic16 -pp18f2550  -c main.c
sdcc -I. -Id:\v\sw\sdcc\include --vc --denable-peeps --optimize-goto --optimize-cmp --optimize-df
--obanksel=9 --opt-code-size --fommit-frame-pointer -mpic16 -pp18f2550  -c usb.c
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:399:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:400:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
usb.asm:401:Warning [220] Address exceeds maximum range for this processor.
(Continue reading)

sdcc | 3 Dec 2007 15:19
Picon

Re: USB compilation for PIC16 - strange errors

Vaclav Peroutka schrieb:
> Hi Raphael,
> 
> thank you very much for your quick response! I corrected the lines as you suggested and it looks much better.
> 
> I have following output (maybe some problems with gputils) - there is EEPROM memory. I noticed it in some
other projects as well so it is not a bug of USB code or SDCC itself.

I used the nuts&volts code to implement a USB-CDC device. For this i had
add the following lines to a local copy of the 18f2550.lkr file.

SECTION    NAME=CONFIG     ROM=config
SECTION    NAME=bank1      RAM=gpr1
SECTION    NAME=usbram4    RAM=usb4
SECTION    NAME=usbram5    RAM=usb5
SECTION    NAME=eeprom     ROM=eedata

IIrc i also had to add

-Wl-s$(lkr_PIC_TYPE).lkr,-m -mpic16 -p$(sdcc_PIC_TYPE)

with $lkr_PIC_TYPE=PIC18F2550 and $sdcc_PIC_TYPE=18f2550 to the compile
options in the Makefile.

Hope this helps

ja

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
(Continue reading)

Vaclav Peroutka | 3 Dec 2007 15:39
Picon
Favicon

Re: USB compilation for PIC16 - strange errors

Hello JA,

> I used the nuts&volts code to implement a USB-CDC device. For this i had
> add the following lines to a local copy of the 18f2550.lkr file.
> 
> SECTION    NAME=CONFIG     ROM=config
> SECTION    NAME=bank1      RAM=gpr1
> SECTION    NAME=usbram4    RAM=usb4
> SECTION    NAME=usbram5    RAM=usb5
> SECTION    NAME=eeprom     ROM=eedata
> 
> IIrc i also had to add
> 
> -Wl-s$(lkr_PIC_TYPE).lkr,-m -mpic16 -p$(sdcc_PIC_TYPE)
> 
> with $lkr_PIC_TYPE=PIC18F2550 and $sdcc_PIC_TYPE=18f2550 to the compile
> options in the Makefile.
> 

I already have it in the LKR file and the makefile as well...

Vaclav

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Raphael Neider | 3 Dec 2007 18:05
Picon

Re: PORTA and PORTB bit structures missing for pic16f88

Without your source code and version numbers this is kinda hard to
debug; lets try anyways...

(1) Probably you are simply using an ancient version of SDCC, 2.6.0?
    Use sdcc -v to tell.
(2) Do you #include "pic14regs.h" or at least #include "pic16f88.h"?
    If you did, recent SDCC versions should have complained about
    redefining PORTA_bits...
(3) How do you compile and link? You must link against libsdcc.lib and
    pic16f88.lib, preferably by mimicking the way SDCC calls the linker
    (see output of 'sdcc -mpic14 -p16f88 main.c -V' for some
    self-contained source file that includes the main() routine.

> missing definition for symbol "_PORTA_bits", required by "led.o"

This indicates that you are not linking with pic16f88.lib (or that your
library is outdated).

> So I edited my main c file (main.c) and added :
> volatile __PORTA_bits_t __at(PORTA_ADDR) PORTA_bits;
> 
> Now I get this error :
> multiple sections using address 0x5

Address 0x05 is defined in the library to be PORTA (I guess). This
indicates that you are linking with pic16f88.lib but are using an
outdated SDCC version. Grab and install a snapshot of the 2.7.4 release
and try again.

> I really don't know how to do this #define so I can simply test and set a pin.
(Continue reading)

Anistardi | 4 Dec 2007 01:56
Picon

USB library of PIC18 series

Hello,

I'm new in SDCC. I have use MPLAB's assembler for my PIC18 series.
I wrote some code to  use USB feature on PIC18F2550 and PIC18F2450,
but it seem the code growing too fast :-(
I look into USB library on SDCC, have anyone convert it from Microchip's
C compiler (C18)?

I'm sorry for my English. It is my third language :-).

Anistardi

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Vaclav Peroutka | 4 Dec 2007 10:01
Picon
Favicon

Re: USB library of PIC18 series

Hello,

we were just talking about it yesterday. Have a look in the sdcc-user archives.

There are some problems with compilation but hopefully Raphael Neider is working on it and will find  some solution.

Vaclav

> Hello,
> 
> I'm new in SDCC. I have use MPLAB's assembler for my PIC18 series.
> I wrote some code to  use USB feature on PIC18F2550 and PIC18F2450,
> but it seem the code growing too fast :-(
> I look into USB library on SDCC, have anyone convert it from Microchip's
> C compiler (C18)?
> 
> I'm sorry for my English. It is my third language :-).
> 
> Anistardi
> 

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Xiaofan Chen | 4 Dec 2007 10:55
Picon

Re: USB library of PIC18 series

On 12/4/07, Anistardi <anis51340@...> wrote:
> Hello,
>
> I'm new in SDCC. I have use MPLAB's assembler for my PIC18 series.
> I wrote some code to  use USB feature on PIC18F2550 and PIC18F2450,
> but it seem the code growing too fast :-(
> I look into USB library on SDCC, have anyone convert it from Microchip's
> C compiler (C18)?
>
> I'm sorry for my English. It is my third language :-).
>

There are assembly based USB stacks for 18F USB PICs.

PIC18F2455/4455 Assembler USB Firmware Stack From Bminch
http://forum.microchip.com/tm.aspx?m=89669
http://pe.ece.olin.edu/ece/projects.html

Olin Lathrop's Assembly based USB firmware stack with
Ping Pong and triple software buffer
http://www.embedinc.com/pic/usb.htm
http://forum.microchip.com/tm.aspx?m=278560
http://forum.microchip.com/tm.aspx?m=141123

And there are some open source projects with SDCC. They are not
as mature as those from Microchip but you might want to try them.

1. PUF using sdcc : http://vasco.gforge.enseeiht.fr/

"PUF is a USB application framework dedicated to Linux (on the host
(Continue reading)

Peter S. May | 5 Dec 2007 15:29

Two new pic16 devices added, plus script to facilitate adding more

Greetings --

I have interpreted information for 18F2450 and 18F4450 (the newer,
cheaper siblings of the 18F2550 and 18F4550) from the data sheet
DS39760C. The result of compiling my changes in works, at least for me,
at least no worse than the existing 18F2455 device does. I do get errors
like:

/usr/local/bin/../share/sdcc/include/pic16/pic18f2450.h:162: warning
182:absolute address for sfr 'UFRM' probably out of range.

But the same error occurs for the '2455 already in the sdcc codebase.

pic16sheet2deviceinc is a perl utility I created and used to translate
an annotated description of the new devices as derived from the data
sheet to devices.inc entries. I also made a description for 18F2221
according to the data sheet as a proof of concept; the script produces
the substantive equivalent of what is already in devices.inc for
18F2221. Attached are descriptions for 18F2221, 18F2450, and 18F4450.

Usage:
./pic16sheet2deviceinc.tar 18fxxxx.description

Hopefully some or all of this is useful.  Feel free to edit, restyle, or
rename.

Additions, patches, and script files posted to:
https://sourceforge.net/tracker/index.php?func=detail&aid=1844525&group_id=599&atid=350599

In the process, I also found a slight manual error:
(Continue reading)


Gmane