- Tue Sep 15, 2009 8:38 pm
#81149
I have stock GCC building targeting pic32. I also have [a hacked] GDB working for the pic32 using [a hacked] openocd with flash write support. Programmer tool is the olimex arm-usb-ocd. That tool is hellishly slow at the moment due to USB latency. To fix requires injecting a little code stub into the pic32 to handle tasks onboard without latency. For GCC/GDB/binutils I used the mipsle target. I did not use any libc, my application didn't need one. I just rolled my own startup code. IIRC the gdb hacks were to hack how openocd presented its memory map. GDB uses a 64 bit # to hold addresses, and the mips target in GDB sign extends all addresses. OpenOCD does not sign extend said addresses when passing to GDB. This also means that a contiguous memory space going through 0x80000000 needs to be split into two chunks.
I'm on a business trip at the moment and don't have any of my hacked sources with me, nor build procedures. I'll get em up at some point.
I also have an auto-generated SFR library file / reg defs header from a microchip file that looked as if it was licensed in such a way as to allow usage without a compiler license. I also autogenerated dwarf info for the library file [just contains absolute value symbols for SFRs] so in gdb you can just go p SFR_NAME.
Also - never set the DEBUG bits in the config words if using JTAG. They make weird stuff happen. Said weird stuff is documented nowhere. Specifically, they cause the processor to reset to an as-yet undetermined address, rather than the regular reset vector. This weirdness does not occur on a jtag-initiated reset, nor one initiated via the external reset. Only power-up. That was a fun one to try and figure out [chip works perfectly under debug, never without debugger attached].
RE: all that; in summary, it works, but there is great frustration to be encountered outside the microchip libraries, as things do not work as they are documented in the datasheet. There are a few key registers actually missing from the datasheet!
Cheers,
--David Carne
I'm on a business trip at the moment and don't have any of my hacked sources with me, nor build procedures. I'll get em up at some point.
I also have an auto-generated SFR library file / reg defs header from a microchip file that looked as if it was licensed in such a way as to allow usage without a compiler license. I also autogenerated dwarf info for the library file [just contains absolute value symbols for SFRs] so in gdb you can just go p SFR_NAME.
Also - never set the DEBUG bits in the config words if using JTAG. They make weird stuff happen. Said weird stuff is documented nowhere. Specifically, they cause the processor to reset to an as-yet undetermined address, rather than the regular reset vector. This weirdness does not occur on a jtag-initiated reset, nor one initiated via the external reset. Only power-up. That was a fun one to try and figure out [chip works perfectly under debug, never without debugger attached].
RE: all that; in summary, it works, but there is great frustration to be encountered outside the microchip libraries, as things do not work as they are documented in the datasheet. There are a few key registers actually missing from the datasheet!
Cheers,
--David Carne