> Adding the [PIC] tag. Maybe you are new to PIClist. You need > to add tags like [PIC], [EE], [OT] depending on the content. > http://mailman.mit.edu/mailman/listinfo/piclist Oops. New to posting, yes. (Been lurking for a while now, months or years depending how you count it.) I actually thought they were added by a moderator. Silly me. >> Anyone got the 3.23 toolchain working on 64bit linux/xeon machines? Or >> any >> version compiled for 64bit? I have a feeling that's the issue. > > As far as I know, it is not working under 64bit Linux. > http://www.microchip.com/forums/tm.aspx?m=342218 Another 12 hours of trial and error and I managed to get the 3.23 toolchain built and running. (I'd made some mistakes following the instructions, and also had to 'touch' some extra files, as explained on another page.) pic30-coff-gcc now compiles source to object, pic30-coff-as will assemble, but the linker is giving me grief. For example, here's test.c: int main() { } Can't get much simpler than that. And here's test.sh which I use to compile it: #!/bin/sh PATH=$PATH:$HOME/dev/pic30-3.23/bin bin/pic30-coff-gcc-4.0.3 -v -mcpu=30F3014 -Lpic30-nonfree/lib -ansi -Wl,--heap=0,--script pic30-nonfree/support/dsPIC30F/gld/p30f3014.gld -mlarge-code -o test.cof test.c -mresource=info/c30_device.info Which gives me linker errors: pic30-nonfree/lib/libpic30-coff.a(data_init_standard.o)(.init+0x28):null_signature.s: Link Error: PC Relative branch to 'L91' is out of range. Suggest large-code model. pic30-nonfree/lib/libpic30-coff.a(data_init_standard.o)(.init+0x38):data_init_standard.S: Link Error: PC Relative branch to 'L11' is out of range. Suggest large-code model. pic30-nonfree/lib/libpic30-coff.a(data_init_standard.o)(.init+0x50):data_init_standard.S: Link Error: PC Relative branch to 'L12' is out of range. Suggest large-code model. pic30-nonfree/lib/libpic30-coff.a(data_init_standard.o)(.init+0x56):data_init_standard.S: Link Error: PC Relative branch to 'L32' is out of range. Suggest large-code model. Alternately if I try to build the examples (such as "output.s" supplied by Microchip) I can assemble fine, but again not link. $ cd pic30-nonfree/examples/MPLABC30_Getting_Started/ $ pic30-coff-as -o output.o output.s $ pic30-coff-ld -o output.cof output.o --script ../../support/dsPIC30F/gld/p30f3014.gld --heap=0 -L../../lib/dsPIC30F output.o(.text+0x8):output.s: Link Error: PC Relative branch to 'wait' is out of range. Suggest large-code model. output.o(.text+0xe):output.s: Link Error: PC Relative branch to 'print_string' is out of range. Suggest large-code model. output.o(.text+0x20):output.s: Link Error: PC Relative branch to 'print_string' is out of range. Suggest large-code model. output.o(.text+0x24):output.s: Link Error: PC Relative branch to 'exit' is out of range. Suggest large-code model. The same errors occur even if I strip the command down to just the basics: $ pic30-coff-ld -o output.cof output.o I have copied "pic30-nonfree/support/dsPIC30F/inc/p30f4013.inc" into the directory as "p30F3014.inc" (note the different 'F' capitalization, to match the include statement in "output.s") rather than edit "output.s" or try to append it's location to the include path, so I hope that's not messing things up. Since output.s is pretty self-contained, I don't think this is anything to do with missing libraries. (But what do I know?) I chose that example because it doesn't even involve pic30-coff-gcc, just the assembler and linker. Linking with "--verbose --debug" doesn't give any clues either, in fact it all seems to go fairly well. Some extracts which might be relevant: GNU ld version 2.14 - Microchip v3.23 (0) Dreamhost Build date: Mar-14-2010 Supported emulations: pic30_coff using external linker script: ================================================== /* ** Linker Script for 30f3014 */ [...] ================================================== attempt to open output.o succeeded output.o Loading symbols from output.o (no signature) undefined: _PSVPAG undefined: _U1MODE undefined: _U1STA undefined: _U1TXREG undefined: _U1BRG undefined: CORCON attempt to open ../../lib/dsPIC30F/libp30F3014.a failed attempt to open /home/unorthodox/dev/pic30-3.23/bin/../pic30-coff/lib/libp30F3014.a failed attempt to open ../../lib/dsPIC30F/libp30F3014-coff.a succeeded Loading CodeGuard settings for 30F3014: matching records (procID = 13) .... [...] Looping through the input bfds: input file output.o, procID = 30Fxxxx [...] Locating sections with mask ffffffff, but not 0 locate_options = 0, exclude_addr = 0 input section ".text", len = 26, attributes = code consider block at 10e, len = 3ef2 option1 [advancing from 10e] option1 aligned at 10e option2 [descending from 3fda] option2 aligned at 3fda option1 = 10e, option2 = 3fda updating section info: vma = 10e, lma = 10e creating output section statement ".text%1" creating remainder blocks: 0, 3ecc removing from allocation list [...] After pic30 final link: section flags VMA LMA length ------- ----- ------ ------ ------ .reset 223 0 0 4 .ivt 223 4 4 7c .aivt 223 84 84 7c .const 213 8100 100 e .text 227 10e 10e 26 .dinit 223 134 134 2 .isr 223 136 136 2 Dumping the contents of "output.o" looks OK, but then I'm not sure how the relocation records are supposed to interact with what look like placeholder values in all the 'bra' instructions: $ pic30-coff-objdump output.o -d output.o: file format coff-pic30 Disassembly of section .text: 00000000 : 0: 10 04 e0 cp0.b [w0] 2: 00 00 32 bra Z, 0x4 00000004 : 4: 01 20 ab btst.b 0x1, #0x1 6: 00 00 3a bra NZ, 0x8 8: 01 00 20 mov.w #0x0, w1 a: b0 48 78 mov.b [w0++], [w1] c: 00 00 37 bra 0xe 0000000e : e: 00 00 06 return 00000010 <__reset>: 10: 00 40 a8 bset.b 0x0, #0x2 12: 00 00 20 mov.w #0x0, w0 14: 00 00 88 mov.w w0, 0x0 16: 00 20 ef clr.w 0x0 18: 01 e0 a8 bset.b 0x1, #0x7 1a: 01 40 a8 bset.b 0x1, #0x2 1c: 00 00 20 mov.w #0x0, w0 1e: 00 00 07 rcall 0x20 00000020 : 20: 01 00 ab btst.b 0x1, #0x0 22: 00 00 32 bra Z, 0x24 24: 00 40 da .pword 0xda4000 $ pic30-coff-objdump output.o -r output.o: file format coff-pic30 RELOCATION RECORDS FOR [.text]: OFFSET TYPE VALUE 00000002 PC RELATIVE BRANCH L91 00000004 FILE REG - BYTE _U1STA 00000006 PC RELATIVE BRANCH wait 00000008 WORD _U1TXREG 0000000c PC RELATIVE BRANCH print_string 00000010 FILE REG - BYTE CORCON 00000012 WORD - PSVPAGE hello 00000014 FILE REG - WORD with DST. _PSVPAG 00000016 FILE REG _U1BRG 00000018 FILE REG - BYTE _U1MODE 0000001a FILE REG - BYTE _U1STA 0000001c WORD - PSVOFFSET hello 0000001e PC RELATIVE BRANCH print_string 00000020 FILE REG - BYTE _U1STA 00000022 PC RELATIVE BRANCH exit Sorry about the verbosity, but I'm hoping someone will see something useful. I have the feeling I'm missing something obvious. I tried searching the archives, but got "System FAILURE! The content index is offline." and various Google searches didn't turn up much. It might help if I could find some docs on using the command line tools under linux. The Microchip docs are quite helpful, but they all assume you're using their windows versions. I'm sure the linux port has some subtleties. Anyone care to share their linux "hello world" makefile? (GUI tools aren't really an option, as this is running on a hosted server) So close... -- Jeremy Lee BCompSci (Hons) The Unorthodox Engineers www.unorthodox.com.au -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist