chipKIT® Development Platform

Inspired by Arduino™

PIC32-avrdude-bootloader

Created Wed, 10 Jun 2020 08:28:49 +0000 by ainars


ainars

Wed, 10 Jun 2020 08:28:49 +0000

Good day! I have issues to compile bootloader for UDB32_MX2_DIP. I ussed github repository and i dont made modifications on source code and i get compile errors. How to fix it ? Please see attached file with errors.


majenko

Wed, 10 Jun 2020 10:24:08 +0000

To compile for the MX1/2 chips you need the -mips16 option to the XC32 compiler, and that's only available in the full paid-for version.

Instead you can use the Makefile from Linux (or maybe OS X or WSL) with the pic32-tools compiler from chipKIT-core which should work. There's no definition in the Makefile for the UBD_MX2_DIP, so you'll have to craft one (copy and paste one of the existing ones).


majenko

Wed, 10 Jun 2020 11:10:56 +0000

Actually, there may be. It's openbci-ubd32. So:

$ make openbci-ubd32

should do the trick, as long as you have set the path and prefix in the Makefile for pic32-tools. I use:

BINPREFIX=~/.uecide/compilers/pic32-tools/bin/pic32-

ainars

Thu, 11 Jun 2020 13:01:18 +0000

Thanks for info Is it possible to program chip withouth bootloader ussing pickit4 and arduino IDE ? I tried but something goes wrong simple led blink example dosnt working MCU use external oscilator @ 8Mhz and i need modifiiced bootloader for SUPERVISOR IC


majenko

Thu, 11 Jun 2020 13:26:23 +0000

It is, but you need to link your code with a different bootloader. There should be a "-nobootloader" variant of the MX250 linker script in the core ("chipKIT-application-32MX250F128-nobootloader.ld"), but getting it to use it is tricky, since you need to alter the boards.txt file.

What exactly needs modifying in the bootloader?


ainars

Fri, 12 Jun 2020 08:35:17 +0000

I need to hold high gpio Pin for SUPERVISOR IC to hold power on state Pin is SOSCO/RPA4/T1CK/CTED9/PMA1/RA4 device is PIC32MX250F128B I need this for openbci bootloader and also need to disable blinking led


majenko

Fri, 12 Jun 2020 10:16:37 +0000

Does this work for you?


ainars

Fri, 12 Jun 2020 11:33:54 +0000

No it dosnt work :( GPIO pin isnt HIGH


majenko

Fri, 12 Jun 2020 12:51:43 +0000

Hmm... let me try again...


majenko

Fri, 12 Jun 2020 12:57:33 +0000

Hmmm... are you sure? Just before it enters the main loop of the bootloader once it's determined that the bootloader should actually run it now has

TRISACLR = 1<<4; 
LATASET = 1<<4;

Of course it won't do that if the bootloader doesn't get run, and that may also get cleared when the bootloader exits.

I've moved it to be the very first operation at the start of main() now so it should happen regardless of the state of the bootloader.


ainars

Fri, 12 Jun 2020 14:28:38 +0000

Thanks now its works as ecpected.


majenko

Fri, 12 Jun 2020 14:49:15 +0000

Excellent. I'm actually working on a bootloader building system (web based) at the moment, though how far along I'll get I have no idea ;)

I'll add the ability to populate the INIT and (when I commit it) EARLY_INIT hooks from there.

Of course, I have to get that system actually doing anything useful first ;)


ainars

Sat, 13 Jun 2020 11:46:27 +0000

Now its working but something is strange i think it is not bootloader problem When i upload bootloader and app to mcu all works great until i push reboot button or power off after that mcu donst work unti i agin flash bootloader and app .


majenko

Sat, 13 Jun 2020 19:26:59 +0000

That sounds like the app is maybe overwriting part of the bootloader. The problem with those smaller chips is they only have 3kB of boot flash, and that's not enough to fit in a USB bootloader. So part of the program flash is used as well, in a "split flash" mode.

But of you have the wrong linker script or the linker script has an error then it's possible that a large program could overwrite that "split" part of the bootloader and make you have to reinstall it again.