chipKIT® Development Platform

Inspired by Arduino™

Porting to XC32++ getImageHeaderInfoStructure initialization

Created Thu, 06 Feb 2014 06:32:07 +0000 by fatboyatdesk


fatboyatdesk

Thu, 06 Feb 2014 06:32:07 +0000

I tried to upgrade my local code base of chipkit core to the latest and have a problem with the interrupt vector initialization. I don't use the boot loader and choose to run in MPLABX.

The new code seems to rely on the linker to setup the vector that is returned by getImageHeaderInfoStructure().

The comments talk about this being setup in a linker script. I don't know where this script is or what it is called (I am currently using UN032). I am struggling to get this table initialized which seems to now be need and I am sure is more efficient but toasts my development environment and all I really wanted was internal pullups :-(. Anyone know anything about how this works.

Thanks Allan in Vancouver


majenko

Thu, 06 Feb 2014 10:46:02 +0000

The linker script is called chipKIT-application-COMMON.ld and is in hardware/pic32/cores/pic32

When you compile, make sure your link command has two -T entries - one for the -COMMON linker script, and also one specific to the chip on your chipKIT board. They are also in the same place, and are named chipKIT-application-32MX...


fatboyatdesk

Sun, 09 Feb 2014 07:17:45 +0000

Ok, so getting a little closer.. Got the linker files in found that the stack and heap nolonger can be declared in the linker file...

Now hitting the following around eeprom (which I am not familiar with )

c:/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:49: warning: memory region `kseg0_eeprom_mem' not declared
c:/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:57: warning: memory region `exception_mem' not declared
c:/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:454: warning: memory region `kseg0_program_mem' not declared
c:/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:564: warning: memory region `configsfrs' not declared
c:/microchip/xc32/v1.21/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:605: warning: memory region `kseg1_data_mem' not declared
hardware\pic32\cores\pic32\chipKIT-application-COMMON.ld:1: non constant or forward reference address expression for section .eeprom_pic32

I can probably figure this out myself but any hints appreciated before I start again in the morning.

Thanks Allan


majenko

Sun, 09 Feb 2014 11:00:36 +0000

It might be the order you have your linker scripts in. I think the order matters, and some things in the -COMMON one are using references from the -P32MX... one. Try swapping them around in the compilation command.

Personally I'd take a look at MPIDE's verbose output and replicate it as closely as possible.


fatboyatdesk

Sun, 09 Feb 2014 21:10:49 +0000

Thanks Majenko,

You appear to be spot on but I am still not there yet... I have have both files in the linker option but when I turn on verbose logging for the linker I see only one being referenced. In this case it is common and is missing the memory regions defined in the chip specific. I can't figure out out how to get the linker to run them both. This is starting to feel link an MPLABX issue.

Scarily the linker command line is 2700 chars long. :shock: I will keep digging and keep the thread updated.

I really appreciate the work you and the rest of the folks have put in here.

Regards Allan in Vancouver.


fatboyatdesk

Mon, 10 Feb 2014 02:36:53 +0000

One step closer... The chip specific linker script has and include of the common at the bottom which is commented out. Un-commenting and removing the common linker script has me moving forward. Not there yet but can see the light at the end of the tunnel.

Hope it isn't a train :-)

Allan


guymc

Mon, 10 Feb 2014 23:57:18 +0000

Hi Allan,

Glad to hear you are making progress on this issue.

The person best suited to help (Jason, our resident compiler expert) is away on holiday at the moment. We expect him back on Thursday or Friday (2/13 or 2/14).

Try not to get stuck until then :-)

Cheers