chipkit32 / pic32-avrdude-bootloader Goto Github PK
View Code? Open in Web Editor NEWThe 'new' bootloader for MPIDE/chipKIT PIC32 boards
The 'new' bootloader for MPIDE/chipKIT PIC32 boards
hi
i downloaded the PIC32-avrdude-bootloader and loaded it in MPLAB X IDE v4.05
i want try to compile the bootloader for the Lenny Board ( Majenko ) and saw,
that there is majenko.h available and Lenny Board is on the list
but the "set Configuration" ( right click on Main Project folder ) to this was missing.
so i did open the "customize" and created over "Manage Configurations"
a new "MAJENKO_LENNY"
with PIC32MX270F256D and PICKit3 and XC 1.44 compiler and set it to active.
after set this config as active, i saw, that in "majenko.h" never "BOARD_MAJENKO_LENNY" config highlighted - there is highlighted "BOARD_MAJENKO_ULTRANANO" and i think this is wrong.
a test with a compile, and upload with PICkit3 there is opposite the highlighted "ULTRANANO" PIC32MX270F256D as Device ( left bottom corner ) but i think this comes from the "RGB_STATION_USB_BLE" Board.
for a simply test, i changed the PIC in Lenny Config from 256D to 128D for look,
does this make a change - but did not. the 270F256D comes from the "RGB_STATION_USB_BLE" board then.
can someone check this or better - can someone add the "set configuration" for the "Board Lenny"?
or is this a "bug" in MPLAP-X?
i want test the Bootloader Program Button on RB13 or RA10 on a Breadboard Version with an PIC32MX270F256D with same setup like the Lenny Board is for deeper learn and how it works.
thank you so much!
best wishes
rudi ;-)
The number of boards in the BoardConfig.h file is getting quite large now, and it's hard to navigate. I would suggest breaking this board down into a "wrapper" file with all the top and bottom portions in it, and then move all the actual board configuration blocks out into separate header files (either a single header for each board, or multiple boards by the same vendor or in the same family together in a header) so that it's possible to just jump in to the board configuration you want (and to copy that section and edit it for a new board).
This new configuration can be identical to the RGB Station, as they both use USB bootloader and the PIC32MX270 CPU.
I cloned the UART MPLAB config and changed the capabilities in microchip.h
to blCapUSBInterface
. In looking at the build output for a Fubarino SD USB, I see cdccam.o
. Do I need to make further changes to the MPLAB config for the M7 board to include the necessary USB code? Thanks!
CLEAN SUCCESSFUL (total time: 59ms)
make -f nbproject/Makefile-MICROCHIP_MZ_STARTER_KIT_USB.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X'
make -f nbproject/Makefile-MICROCHIP_MZ_STARTER_KIT_USB.mk dist/MICROCHIP_MZ_STARTER_KIT_USB/production/chipKIT-Bootloaders.X.production.hex
make[2]: Entering directory '/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X'
"/Applications/microchip/xc32/v2.05/bin/xc32-gcc" -c -mprocessor=32MZ2048EFM144 -MMD -MF build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_cache.o.d -o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_cache.o ../pic32_init_cache.S -DXPRJ_MICROCHIP_MZ_STARTER_KIT_USB=MICROCHIP_MZ_STARTER_KIT_USB -no-legacy-libc -ftoplevel-reorder -Wa,--defsym=__MPLAB_BUILD=1,-MD=build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_cache.o.asm.d,--gdwarf-2 -DPIC32MZ -DINIT_MMU_MZ_FIXED -DINIT_SSX -DINIT_L1_CACHE -DINIT_DSPR2 -DPIC32_SRS_SET_COUNT=8
"/Applications/microchip/xc32/v2.05/bin/xc32-gcc" -c -mprocessor=32MZ2048EFM144 -MMD -MF build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/crt0MZ.o.d -o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/crt0MZ.o ../crt0MZ.S -DXPRJ_MICROCHIP_MZ_STARTER_KIT_USB=MICROCHIP_MZ_STARTER_KIT_USB -no-legacy-libc -ftoplevel-reorder -Wa,--defsym=__MPLAB_BUILD=1,-MD=build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/crt0MZ.o.asm.d,--gdwarf-2 -DPIC32MZ -DINIT_MMU_MZ_FIXED -DINIT_SSX -DINIT_L1_CACHE -DINIT_DSPR2 -DPIC32_SRS_SET_COUNT=8
"/Applications/microchip/xc32/v2.05/bin/xc32-gcc" -c -mprocessor=32MZ2048EFM144 -MMD -MF build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_tlb_ebi_sqi.o.d -o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_tlb_ebi_sqi.o ../pic32_init_tlb_ebi_sqi.S -DXPRJ_MICROCHIP_MZ_STARTER_KIT_USB=MICROCHIP_MZ_STARTER_KIT_USB -no-legacy-libc -ftoplevel-reorder -Wa,--defsym=__MPLAB_BUILD=1,-MD=build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_tlb_ebi_sqi.o.asm.d,--gdwarf-2 -DPIC32MZ -DINIT_MMU_MZ_FIXED -DINIT_SSX -DINIT_L1_CACHE -DINIT_DSPR2 -DPIC32_SRS_SET_COUNT=8
"/Applications/microchip/xc32/v2.05/bin/xc32-gcc" -g -x c -c -mprocessor=32MZ2048EFM144 -D_BOARD_MICROCHIP_ETH_START_KIT_USB_ -I.. -MMD -MF build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o.d -o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o ../main.c -DXPRJ_MICROCHIP_MZ_STARTER_KIT_USB=MICROCHIP_MZ_STARTER_KIT_USB -no-legacy-libc -ftoplevel-reorder
"/Applications/microchip/xc32/v2.05/bin/xc32-gcc" -mprocessor=32MZ2048EFM144 -nostdlib -nostartfiles -mno-float -o dist/MICROCHIP_MZ_STARTER_KIT_USB/production/chipKIT-Bootloaders.X.production.elf build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/crt0MZ.o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_cache.o build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/pic32_init_tlb_ebi_sqi.o -DXPRJ_MICROCHIP_MZ_STARTER_KIT_USB=MICROCHIP_MZ_STARTER_KIT_USB -no-legacy-libc -ftoplevel-reorder -Wl,--defsym=__MPLAB_BUILD=1,--script="../MZ-boot-linkerscript.ld",--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="dist/MICROCHIP_MZ_STARTER_KIT_USB/production/chipKIT-Bootloaders.X.production.map",--memorysummary,dist/MICROCHIP_MZ_STARTER_KIT_USB/production/memoryfile.xml
nbproject/Makefile-MICROCHIP_MZ_STARTER_KIT_USB.mk:198: recipe for target 'dist/MICROCHIP_MZ_STARTER_KIT_USB/production/chipKIT-Bootloaders.X.production.hex' failed
build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o: In function `usb_print':
make[2]: Leaving directory '/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X'
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:673: undefined reference to `cdcacm_attached'
nbproject/Makefile-MICROCHIP_MZ_STARTER_KIT_USB.mk:103: recipe for target '.build-conf' failed
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:673: undefined reference to `cdcacm_active'
make[1]: Leaving directory '/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X'
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:674: undefined reference to `cdcacm_print'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o: In function `ExecuteApp':
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/main.c:631: undefined reference to `usb_uninitialize'
build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o: In function `InitStk500v2Interface':
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:666: undefined reference to `usb_initialize'
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:667: undefined reference to `null_reset_cbfn'
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:667: undefined reference to `null_reset_cbfn'
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/BoardConfig.h:667: undefined reference to `cdcacm_register'
build/MICROCHIP_MZ_STARTER_KIT_USB/production/_ext/1472/main.o: In function `main':
/Users/bittond/GoogleDrive/src/PIC32-avrdude-bootloader/bootloaders/main.c:229: undefined reference to `usb_isr'
collect2: error: ld returned 255 exit status
make[2]: *** [dist/MICROCHIP_MZ_STARTER_KIT_USB/production/chipKIT-Bootloaders.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 575ms)
Right now, when I build a bootloader using the makefile, the hex file produced does not match the hex file produced from MPLABX. I'm assuming this is because of differences in the command line options given to each system for building. I'm trying to work out the differences in command line options, but haven't hit on the magic set yet for the makefile that allows it to produce the same output as MPLAB X. I really like using the makefile as it's much faster (don't have to fire up MPLAB X) and you can have it build all hex files at one time which is awesome.
I think the task here is to harmonize the command line options between MPLAB X configurations and the makefile. I'm not saying that the MPLAB X options are exactly right - maybe they need to change too. But I think it would be good if both ways of compiling produced identical output.
I have been using the "DP32" but had to get a new chipkit PicKit3 programmer and now need to upload the bootloader hex to it so i can load arduino files onto it. I need to use the USB features and i'm planning to use the PIC32MX250F128B.
I am unable to find the bootloader i need in the https://github.com/chipKIT32/PIC32-avrdude-bootloader/tree/master/BootloadersCurrent-hex
Any advice? Thanks!
When running the bootloader on the PIC32 simulator in MPLAB X, the execution is very slow. The 2 second timeout that is used on UART-based bootloaders takes upwards of 6 minutes to run on the simulator.
If there is a way, the bootloader should detect whether it is running on real hardware or on the simulator (I'm checking with the simulator team to see if this is possible), and then bypass some of the delays in order to speed up execution.
The bootloaders try to use most or all of boot flash, but there is an area of boot flash on MX devices that is used for a debug executive by MPLAB tools (Real ICE, ICD 3, PICkit 3, even chipKIT Prog). The result is that MPLAB projects that have the bootloader as a loadable will not be able to execute, as the bootloader will fail to operate.
Ideally, the area for the debug executive would be blocked out by the linker script. This might have to be done for future boards only, rather than clobber existing product bootloaders.
I have tested the bootloader for the Pinguino micro with the new 1.6.8 Arduino IDE and here the issues:
1- Using the Olimex_Pinguino_Micro_UART_57600.hex, it is not detected as a USB connected device and it is not possible to upload sketches using the Arduino IDE
2- Using the Olimex_PIC32_Pinguino.hex the Arduino IDE can program the board, it runs but if you disconnect the board and then connect it back the board is in a reset state and does not run the sketch, even resetting it or pushing the buttons does not work.
any suggestions?
Hi all,
Using Mplab X IDE v5.3 and latest XC32 compiler with optimisations enabled on ubuntu, just downloading the git repo and trying to clean and build the Majenko ds mini configuration I get the following errors
1.
Assembler error Expression out of range on line 268 of crt0.S
266 _dinit_end:
267 addu SRC,3
268 addiu LEN,$0,0xFFFFFFFC
TRISCCLR undeclared in BoardConfig.h in the following line
#define EnableBootLED() (CAT_3(TRIS,BLedLat,CLR) = (1 << BLedBit))
and LATCCLR undeclared as well
I assume these are macros to control the pin input/output state? Why aren't they declared? am I missing plib or something?
Thanks in advance!
The WF32 web page is down (https://reference.digilentinc.com/reference/microprocessor/wf32/start) and I couldn't find the bootloader hex file anywhere. Can you upload the hex file?
Thank you
There's no actual linker script for PIC32MM devices and the double word programming that they support
The post-compilation command to copy the .hex file to the bootloader images folder is a Windows specific command.
This breaks the compilation on people using a real operating system.
Why not just change the "ImagePath" in the project?
The bootloaders, if fed a hex file that contains addresses the bootloader currently occupies, will erase the corresponding pages and attempt to write to them. Eventually a page will be erased that the bootloader is currently executing, and will subsequently crash.
The bootloaders need to know what areas it occupies, and prevent any addresses in those areas from being erased or programmed.
The bootloader works briljantly on a Fubarino mini. I want to compile the bootloader for a custom pcb with different parameters to switch between program and application state.
I can't however, get the FUBARINO_MINI_USB code to compile.
My compiler is the XC32 Free edition.
This is the output from MPLABX:
CLEAN SUCCESSFUL (total time: 79ms) make -f nbproject/Makefile-FUBARINO_MINI_USB.mk SUBPROJECTS= .build-conf make[1]: Entering directory '/home/gregoor/MPLABXProjects/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X' make -f nbproject/Makefile-FUBARINO_MINI_USB.mk dist/FUBARINO_MINI_USB/production/chipKIT-Bootloaders.X.production.hex make[2]: Entering directory '/home/gregoor/MPLABXProjects/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X' ../cdcacm.c:1:0: warning: Compiler option (Optimize for size) ignored because the free XC32 C compiler does not support this feature. [enabled by default] /**** cdcacm.c **************************************************************** ^ cc1: note: Disable the option or visit http://www.microchip.com/MPLABXCcompilers to purchase a new MPLAB XC compiler license. ../main.c:1:0: warning: Compiler option (Optimize for size) ignored because the free XC32 C compiler does not support this feature. [enabled by default] /**** main.c ****************************************************************** ^ cc1: note: Disable the option or visit http://www.microchip.com/MPLABXCcompilers to purchase a new MPLAB XC compiler license. ../usb.c:1:0: warning: Compiler option (Optimize for size) ignored because the free XC32 C compiler does not support this feature. [enabled by default] /**** usb.c ******************************************************************* ^ cc1: note: Disable the option or visit http://www.microchip.com/MPLABXCcompilers to purchase a new MPLAB XC compiler license. "/opt/microchip/xc32/v1.42/bin/xc32-gcc" -c -mprocessor=32MX250F128D -I.. -MMD -MF build/FUBARINO_MINI_USB/production/_ext/1472/crt0.o.d -o build/FUBARINO_MINI_USB/production/_ext/1472/crt0.o ../crt0.S -DXPRJ_FUBARINO_MINI_USB=FUBARINO_MINI_USB -no-legacy-libc -ftoplevel-reorder -Wa,--defsym=__MPLAB_BUILD=1,-MD=build/FUBARINO_MINI_USB/production/_ext/1472/crt0.o.asm.d,--gdwarf-2,-I.. "/opt/microchip/xc32/v1.42/bin/xc32-gcc" -g -x c -c -mprocessor=32MX250F128D -mips16 -mno-float -Os -D_BOARD_FUBARINO_MINI_USB_ -I.. -MMD -MF build/FUBARINO_MINI_USB/production/_ext/1472/cdcacm.o.d -o build/FUBARINO_MINI_USB/production/_ext/1472/cdcacm.o ../cdcacm.c -DXPRJ_FUBARINO_MINI_USB=FUBARINO_MINI_USB -no-legacy-libc -ftoplevel-reorder "/opt/microchip/xc32/v1.42/bin/xc32-gcc" -g -x c -c -mprocessor=32MX250F128D -mips16 -mno-float -Os -D_BOARD_FUBARINO_MINI_USB_ -I.. -MMD -MF build/FUBARINO_MINI_USB/production/_ext/1472/main.o.d -o build/FUBARINO_MINI_USB/production/_ext/1472/main.o ../main.c -DXPRJ_FUBARINO_MINI_USB=FUBARINO_MINI_USB -no-legacy-libc -ftoplevel-reorder "/opt/microchip/xc32/v1.42/bin/xc32-gcc" -g -x c -c -mprocessor=32MX250F128D -mips16 -mno-float -Os -D_BOARD_FUBARINO_MINI_USB_ -I.. -MMD -MF build/FUBARINO_MINI_USB/production/_ext/1472/usb.o.d -o build/FUBARINO_MINI_USB/production/_ext/1472/usb.o ../usb.c -DXPRJ_FUBARINO_MINI_USB=FUBARINO_MINI_USB -no-legacy-libc -ftoplevel-reorder "/opt/microchip/xc32/v1.42/bin/xc32-gcc" -mprocessor=32MX250F128D -nostdlib -nostartfiles -mips16 -mno-float -o dist/FUBARINO_MINI_USB/production/chipKIT-Bootloaders.X.production.elf build/FUBARINO_MINI_USB/production/_ext/1472/main.o build/FUBARINO_MINI_USB/production/_ext/1472/crt0.o build/FUBARINO_MINI_USB/production/_ext/1472/cdcacm.o build/FUBARINO_MINI_USB/production/_ext/1472/usb.o -DXPRJ_FUBARINO_MINI_USB=FUBARINO_MINI_USB -no-legacy-libc -ftoplevel-reorder -Wl,--defsym=__MPLAB_BUILD=1,--script="../MX1-2-USB-boot-linkerscript.ld",--no-code-in-dinit,--no-dinit-in-serial-mem,-L"../../../../../../opt/microchip/xc32/v1.42/pic32mx/lib",-L"../../../../../../../../Program Files (x86)/Microchip/MPLAB C32 Suite/lib",-L"../../../../../../../../Program Files (x86)/Microchip/MPLAB C32 Suite/pic32mx/lib",-Map="dist/FUBARINO_MINI_USB/production/MX7cK.X.production.map",--memorysummary,dist/FUBARINO_MINI_USB/production/memoryfile.xml,-Os nbproject/Makefile-FUBARINO_MINI_USB.mk:188: recipe for target 'dist/FUBARINO_MINI_USB/production/chipKIT-Bootloaders.X.production.hex' failed make[2]: Leaving directory '/home/gregoor/MPLABXProjects/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X' nbproject/Makefile-FUBARINO_MINI_USB.mk:97: recipe for target '.build-conf' failed make[1]: Leaving directory '/home/gregoor/MPLABXProjects/PIC32-avrdude-bootloader/bootloaders/chipKIT-Bootloaders.X' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/../../../../bin/xc32-ld: dist/FUBARINO_MINI_USB/production/chipKIT-Bootloaders.X.production.elf section '.splitrodata' will not fit in region 'split_program_mem' build/FUBARINO_MINI_USB/production/_ext/1472/main.o: Link Error: Could not allocate section .text, size = 3208 bytes, attributes = code Link Error: Could not allocate program memory collect2: error: ld returned 255 exit status make[2]: *** [dist/FUBARINO_MINI_USB/production/chipKIT-Bootloaders.X.production.hex] Error 255 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 899ms)
When I try to build FUBARINO_SDZ_UART the build is successful.
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.