Building chipKIT compiler on Ubuntu 14.04 64-bit

Work prioritization by the chipKIT core development team
jdeguire
Posts: 10
Joined: Wed Mar 23, 2016 7:39 pm

Re: Building chipKIT compiler on Ubuntu 14.04 64-bit

Post by jdeguire » Fri May 13, 2016 7:27 pm

  • Fix an issue which may prevent device info files from being copied to the right places.
  • If building with DWARF2 exceptions, patch the file "gcc/libgcc/config.host" to provide the pic32mx target with the proper MIPS exception unwind implementation. A backup of the file is made when this is done.
Attachments
chipKIT-cxx-build.sh.txt
(80.23 KiB) Downloaded 28 times

jdeguire
Posts: 10
Joined: Wed Mar 23, 2016 7:39 pm

Re: Building chipKIT compiler on Ubuntu 14.04 64-bit

Post by jdeguire » Thu Aug 04, 2016 6:07 pm

In order to use C++ exceptions, you'll have to use a custom linker script with your project. The default linker scripts inadvertently throw away some exception handling info needed during the stack unwind sequence.

1. Go to <chipKIT_install_dir>/pic32mx/lib/proc/<your_processor> and copy the <your_processor>.ld file into your project.

2. Open up your new script and look for the ".data" section. It will look like this:

Code: Select all

  .data   :
  {
    *( .gnu.linkonce.d.*)            <----- REMOVE ME!
    SORT(CONSTRUCTORS)
    *(.data1)
    . = ALIGN(4) ;
  } >kseg1_data_mem
3. Remove the indicated line shown above. This section contains some info used by GCC's exception handling routines and having it here appears to cause the Microchip-specific linker extensions to not include this section in the data initialization tables. These tables are used to initialize static data and so not having the exception handling pieces in there causes very odd and hard to track problems (guess how I know...).

4. Build with your new linker script by adding the following to your link step:

Code: Select all

-Wl,--script="<your_linker_script>.ld"

Post Reply