From: SourceForge.net <no...@so...> - 2006-08-22 14:02:35
|
Bugs item #1544205, was opened at 2006-08-21 20:42 Message generated for change (Comment added) made by carterson3 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1544205&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pic14 target Group: non bugs Status: Closed Resolution: Invalid Priority: 5 Submitted By: carterson3 (carterson3) Assigned to: Nobody/Anonymous (nobody) Summary: how do i create a PORTD typedef? Initial Comment: #include <pic16f877a.h> // ----- PORTD bits -------------------- typedef union { struct { unsigned char :1; unsigned char :1; unsigned char :1; unsigned char :1; unsigned char LED0:1; unsigned char :1; unsigned char :1; unsigned char :1; }; } __PORTD_bits_t; extern volatile __PORTD_bits_t __at(PORTD_ADDR) PORTD_bits; #define LED0 PORTD_bits.LED0 void main() { TRISD = 0; LED0 = 1; //this line doesnt work... while(1) {}; } sdcc: mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ ds400/hc08 2.6.1 #4339 (Aug 18 2006) (MINGW32) C:\SDCC>sdcc -mpic14 -p16f877a main.c message: using default linker script "C:\sdcc\gputils\lkr\16f877a.lkr" error: missing definition for symbol "_PORTD_bits", required by "main.o" I am trying to get SDCC to work on SBC44B from modtronix. I got it to work a little, but dont really have a clue how to get a PORTD typedef to work... Thanks so much for looking. I appreciate it. -e...@re... (jim pruett) ---------------------------------------------------------------------- >Comment By: carterson3 (carterson3) Date: 2006-08-22 14:02 Message: Logged In: YES user_id=1325633 I replaced: extern volatile __PORTD_bits_t __at(PORTD_ADDR) PORTD_bits; with volatile __PORTD_bits_t __at(PORTD_ADDR) PORTD_bits; and now it says: c:\sdcc> sdcc -mpic14 -p16f877a main.c message: using default linker script "C:\sdcc\gputils\lkr\16f877a.lkr error: multiple sections using address 0x8 -thanks tecodev, for continued help, carterson2 ---------------------------------------------------------------------- Comment By: Raphael Neider (tecodev) Date: 2006-08-22 12:07 Message: Logged In: YES user_id=1115835 If PORTD is not declared in pic16f877a.h (and thus PORTD_bits defined in device/lib/pic/libdev/pic16f877a.c), you need not only declare PORT_bits (using "extern foo;") but also define it (leave out the extern keyword). Extern tells SDCC that the symbol PORTD_bits is defined in a different .o file and resolved by the linker. You want to tell SDCC that PORTD_bits resides at PORTD_ADDR and is (probably) not defined elsewhere. This is not SDCC specific, but a common C construct... To cut it short: delete extern, recompile, be happy. Regards, Raphael ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1544205&group_id=599 |