-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Compile Bootloader for Microchip MZ Starter Kit USB #44
Comments
I believe so. You need to enable the right files and disable the right ones
(right click on the file when in the configuration in question, and you can
enable/disable individual files from the build). Then setting the proper
flag in the .h file, and I think that's it.
*Brian
…On Thu, Feb 8, 2018 at 1:38 PM, David B. Bitton ***@***.***> wrote:
A little more research, and I do see a difference amongst the project
files. For example, this is for the Fubarino SD USB:
[image:
menubar_and_mplab_x_ide_v4_10_-_chipkit-bootloaders___fubarino_sd_usb]
<https://user-images.githubusercontent.com/277207/35993879-baab7ca4-0cdc-11e8-8a9d-7b332cb10fca.png>
Where as the Microchip board is:
[image:
menubar_and_mplab_x_ide_v4_10_-_chipkit-bootloaders___microchip_mz_starter_kit_usb]
<https://user-images.githubusercontent.com/277207/35993806-6f7b476e-0cdc-11e8-9e2d-1958267c17a1.png>
So I think I answered my own question, but is this all the necessary
changes to go from UART to USB?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbeCCo29sklBTCoBwKxEVJ_-1VX7v_zks5tS0ungaJpZM4R-5Sg>
.
|
@EmbeddedMan I'm making "progress". I [en|dis]abled the USB and Serial files, and now I have this build output. From the looks of it, I'm missing a lib.
I need to do some addt'l poking around. |
Ahhh. @majenkotech may be able to help us here. Matt, is this because the bootloader (as it stands now) doesn't support MZ USB? (I can't remember what the state of things are.) |
For example, where is |
@EmbeddedMan I think you're onto something. I'm guessing based on this, that |
You cannot use the PIC32 avrdude bootloader with the MZ chips for anything other than simple UART access. No amount of bending the code will fix it - the plain and simple fact is there is no USB stack there for the MZ chips. Which is why I wrote my own AN1388 compatible bootloader for the MZ chips using the new USB stack in the forthcoming version of chipKIT. |
@majenkotech how do I go about using this w. my PIC32MZ2048EFM144 starter board? Also, which board target shall I use in the Arduino IDE as the starter kit board is not listed amongst the chipKit-core boards? |
Step one is to get the Arduino IDE working with the github version of the core. Then load the sketch and make sure the config bits are right for your board, and tweak anything else that needs tweaking. You'll also need to make a custom board in the boards.txt file that uses the linker scripts in the MZBoot repo. Then compile it and (find and) burn the .HEX file using your chosen programmer (you can't do that bit from the IDE - use MPLAB-X IPE or something for that). Then cross your fingers and hope it works. You'll need the latest pic32prog as well (https://github.com/majenkotech/pic32prog-autotools/releases/tag/2.1.37) as it fixes some nasty bugs in the AN1388 protocol. If it works you will then need to make another new board in boards.txt to use the "hid" programming tool and set the VID/PID for programming. I forget what the values to set are off hand, since I never use the Arduino IDE :P |
Should that custom board be a copy of an existing chipKit board? Shall I just overwrite the pic32prog in the Arduino folder with your pic32prog? do you use MPIDE? |
@majenkotech is OpenScope yours? Is it using the AN1388 bootloader? |
@majenkotech is OpenScope yours? Is it using the AN1388 bootloader?
Hell no.
The OpenScope is a Wi-FIRE with an R-2R ladder DAC added. It has an FT-232R as the interface, which means UART only. It looks like (or the one Dave Jones has certainly looks like) it has an unpopulated USB socket on there that may be connecting directly to the D+/D- pins of the MZ chip, but since I hadn't written the USB stack when Digilent were vomiting that thing up I guess they felt there was no need to populate it.
I can kinda see where they were wanting to go with the OpenScope, but I don't think it really worked. I mean - an "oscilloscope" with no scope frontend? Nah...
|
It should be copy of a board that provides the right pin configuration for your target board. If one doesn't exist you may get away with copying something that is close. Ideally, though you'd craft proper Board_Defs.h and Board_Data.c files for your board. |
I'm always looking for a challenge but I think a fair amount of this is above my pay grade. In the end, I just want an 36mm square MZ board with as many UARTs, SPI, I2C, and CAN as possible; little to no I/O. Well, onward and upward. Thanks! |
@majenkotech I just read something you wrote in the chipKit forum in 2014. Perhaps I shouldn't kill myself over getting "Arduino" working and just write some code. How's Harmony as a platform? |
As an idea Harmony is great. Its implementation, though, is a complete nightmare. That is, from my perspective. The code is so massively obfuscated and macrofied, that it's impossible to work out what is going on. I have never liked Microchip's programming style, and Harmony has it in spades. It's the kind of system where, if you know how it works, is possible to work with. However if you don't, you're pretty much screwed. We tried integrating Harmony with chipKIT for the USB stack some time ago. It only just worked, and required someone from within the Harmony team to actually get us that far. By just worked, it was buggy as hell, with Linux complaining about being unable to get report descriptors and causing USB stack lockups and things. So after maybe 2 years of trying we gave up, and while on holiday for a week in wettest, windiest, West Wales I wrote an entire USB stack entirely from scratch. The Arduino API (and especially the chipKIT variant of it) has come on a long way since I wrote that post. The facilities we now have, with the USB stack, DisplayCore, DFATFS, the I2S libraries I am currently working on, etc, in my opinion are both far easier and more powerful than Microchip's Harmony offering. The only caveat, though, is that you need a board definition for your board to be able to work with chipKIT, and that (especially for an MZ chip) can be a bit of a pain to create. As far as the bootloader goes you can probably get away with using the Wi-FIRE as the basis (actually the No-FIRE would be better that Brian created, since it's not got the hacky crud that Digilent forced on us by switching chips suddenly and not wanting a new board definition) for your configuration. Just copy the section in boards.txt and give it a new name. Change the linker scripts to the ones in the repo, and it should just work. The biggest problem will come when you want to actually use the board itself once you have the bootloader working. It's then that you really need a proper set of board definition files in order to map the peripherals and name the pins properly. |
OK. I will continue to plod along. Perhaps microchip can provide the definitions as it is there board I'm working with. |
Nah. They'd just pass it on to Sharon, and she'd pass it on to me :P I might have an MZEF Curiosity board here somewhere I think. Not sure how it compares to that one though. It does look somewhat like the experimental DA starter kit I have that I have been meaning to get to grips with though, but that's a BGA chip, so I'll bet the pinout's completely different. |
I followed your suggestion and used the PONTECH NoFire board type and received the following:
I built and installed the bootloader for this board from within MPLAB X. |
I can see two things wrong there:
|
yes, i'm NOT using your bootloader largely because I couldn't figure out the necessary steps to compile it. I want to see if I can get the UART method working first before I move on to something more experimental. Does that make sense? |
Ah right, I see. I thought you'd compiled the MZ bootloader and were trying to install it. |
@majenkotech didn't you say there was a new chipKit coming down the pike? |
Brian is working on that right now. |
Correct. However, it doesn't affect the bootloader at all. It does
however, allow USB to be used on both MX and MZ boards (thanks to Matt's
awesome work) in the sketches.
Should be available in a day or two hopefully.
*Brian
…On Fri, Feb 9, 2018 at 1:51 PM, Majenko Technologies < ***@***.***> wrote:
Brian is working on that right now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbeCBv_PSwQoGS4svdRIqax7xwLLgGXks5tTKHVgaJpZM4R-5Sg>
.
|
@EmbeddedMan should I hold off on doing anything further w. getting the starter board working until you release the new code? |
I would. You won't be able to get USB working on MZ parts with any chipKIT
core less than 2.0.0.
…On Fri, Feb 9, 2018 at 1:58 PM, David B. Bitton ***@***.***> wrote:
@EmbeddedMan <https://github.com/embeddedman> should I hold off on doing
anything further w. getting the starter board working until you release the
new code?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbeCMyNQUSZafjSUgyCZ-EQ7AWwzh-gks5tTKNjgaJpZM4R-5Sg>
.
|
@EmbeddedMan ok, duly noted. will there be updated bootloader code too? |
Nope. Not unless somebody wants to port the updated USB stack to the
bootloader. (I would _love_ it if somebody did this, but I don't have time
at this point.)
…On Fri, Feb 9, 2018 at 2:46 PM, David B. Bitton ***@***.***> wrote:
@EmbeddedMan <https://github.com/embeddedman> ok, duly noted. will there
be updated bootloader code too?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbeCHLYTehBiHTrTs0obh_l1_YrK2uEks5tTK68gaJpZM4R-5Sg>
.
|
sigh |
@majenkotech I took your suggestion and created this boards.txt definition
and my build output is:
I must be missing a step. |
You need to install my flash library. You can find it here on github.
…On Sat, 10 Feb 2018, 00:33 David B. Bitton, ***@***.***> wrote:
@majenkotech <https://github.com/majenkotech> I took your suggestion and
created this boards.txt definition
############################################################foo.name=MZBoot foo
foo.group=chipKit
# new items
foo.platform=pic32
foo.build.board=_BOARD_FOO_
foo.ldscript=MZ-application-32MZ2048EFG-bootseg.ld
# end of new items
foo.upload.protocol=stk500v2
foo.upload.maximum_size=2080768
foo.upload.maximum_data_size=524288
foo.upload.speed=115200
foo.upload.tool=pic32prog
foo.build.mcu=32MZ2048EFM144
foo.build.f_cpu=200000000UL
foo.build.core=pic32
foo.ldcommon=chipKIT-application-COMMON-MZ-bootseg.ld
foo.build.variant=MZBoot_foo
foo.build.ldscript.path={build.variant.path}
############################################################
and my build output is:
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/bittondb/Library/Arduino15/packages -hardware /Users/bittondb/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/bittondb/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/bittondb/Documents/Arduino/libraries -fqbn=chipKIT:pic32:foo -ide-version=10612 -build-path /var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32-tools/1.43-pic32gcc -prefs=runtime.tools.pic32prog.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/bittondb/Library/Arduino15/packages -hardware /Users/bittondb/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/bittondb/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/bittondb/Documents/Arduino/libraries -fqbn=chipKIT:pic32:foo -ide-version=10612 -build-path /var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32-tools/1.43-pic32gcc -prefs=runtime.tools.pic32prog.path=/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino
Using board 'foo' from platform in folder: /Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3
Using core 'pic32' from platform in folder: /Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3
Warning: Board arduino:avr:lilypado doesn't define a 'build.board' preference. Auto-set to: AVR_LILYPADO
Detecting libraries used...
"/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32-tools/1.43-pic32gcc/bin/pic32-g++" -c -g -O2 -w -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -fno-exceptions -w -x c++ -E -CC -mprocessor=32MZ2048EFM144 -DF_CPU=200000000UL -DARDUINO=10612 -D_BOARD_FOO_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -I/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441/sketch "-I/Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3/cores/pic32" "-I/Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3/variants/MZBoot" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441/sketch/MZBoot.ino.cpp" -o "/dev/null"
"/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32-tools/1.43-pic32gcc/bin/pic32-g++" -c -g -O2 -w -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -fno-exceptions -w -x c++ -E -CC -mprocessor=32MZ2048EFM144 -DF_CPU=200000000UL -DARDUINO=10612 -D_BOARD_FOO_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -I/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441/sketch "-I/Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3/cores/pic32" "-I/Users/bittondb/Library/Arduino15/packages/chipKIT/hardware/pic32/1.4.3/variants/MZBoot" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441/sketch/MZBoot.ino.cpp" -o "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_720441/preproc/ctags_target_for_gcc_minus_e.cpp"
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:51:19: fatal error: Flash.h: No such file or directory
#include <Flash.h>
^
compilation terminated.
exit status 255
Error compiling for board MZBoot foo.f
I must be missing a step.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADouHJeTYRU-M0py6_mT0thF33aOpbQhks5tTOPfgaJpZM4R-5Sg>
.
--
*Matt Jenkins*
Majenko Technologies
http://majenko.co.uk
http://paypal.me/majenko
|
Here's the link: https://github.com/MajenkoLibraries/Flash |
@majenkotech making progress. I had the add your USB library as well along with an
I searched around GitHub and Google without luck. Thanks. |
Did you read the big bold message at the top of the README file for the USB library?
Also read what I wrote up there ^^^^^ - you need the GITHUB version of chipKIT core (which is just on the verge of release). |
ok, using the github core, I'm here now:
I also removed your old USB lib so Arduino won't pick it up. |
David, FYI chipKIT-core v2.0.1 is now available.
*Brian
…On Sat, Feb 10, 2018 at 9:06 PM, David B. Bitton ***@***.***> wrote:
ok, using the github core, I'm here now:
"/Users/bittondb/Library/Arduino15/packages/chipKIT/tools/pic32-tools/1.43-pic32gcc/bin/pic32-g++" -w -Os -Wl,--save-gld=/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch.ld,-Map=/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch.map,--gc-sections -mdebugger -mno-peripheral-libs -nostartfiles -mprocessor=32MZ2048EFM144 -o "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/MZBoot.ino.elf" "/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/cpp-startup.S" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/libraries/Flash/Flash.cpp.o" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/core/Board_Data.c.o" "/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/core/core.a" -L/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648 -lm -T "/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/variants/MZBoot/MZ-application-32MZ2048EFG-bootseg.ld" -T "/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/chipKIT-application-COMMON-MZ-bootseg.ld"
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `sendPacket(unsigned char*, unsigned long)':
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:155: undefined reference to `HID_Raw::sendReport(unsigned char*, unsigned char)'
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:155: undefined reference to `HID_Raw::sendReport(unsigned char*, unsigned char)'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `executeApp()':
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:191: undefined reference to `USBManager::end()'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `USBManager::addDevice(USBDevice&)':
/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/USB.h:281: undefined reference to `USBManager::addDevice(USBDevice*)'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `setup':
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:275: undefined reference to `USBManager::begin()'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `USBHS':
/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/USB.h:205: undefined reference to `vtable for USBHS'
/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/USB.h:205: undefined reference to `vtable for USBHS'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `__static_initialization_and_destruction_0':
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:55: undefined reference to `USBManager::USBManager(USBDriver&, unsigned short, unsigned short, char const*, char const*, char const*)'
/Users/bittondb/GoogleDrive/src/MZBoot/MZBoot.ino:55: undefined reference to `USBHS::_this'
/var/folders/nk/n29krwvj22s9xfk72mk0tt7h0000gn/T/arduino_build_772648/sketch/MZBoot.ino.cpp.o: In function `HID_Raw':
/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/USB.h:774: undefined reference to `vtable for HID_Raw'
/Users/bittondb/Documents/Arduino/hardware/chipkit-core/pic32/cores/pic32/USB.h:774: undefined reference to `vtable for HID_Raw'
collect2: error: ld returned 255 exit status
Using library Flash in folder: /Users/bittondb/Documents/Arduino/libraries/Flash (legacy)
exit status 255
Error compiling for board MZBoot foo.
I also removed your old USB lib so Arduino won't pick it up.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbeCKwy2DFvsOGUxDu2Vnv0G1J3jY_1ks5tTlktgaJpZM4R-5Sg>
.
|
@EmbeddedMan ok, @majenkotech 's code compiled this time. I just loaded the generated .hex file onto the board. Now I have to try and get it to work. |
not so much luck. it looks like Arduino wants to program via UART. Not sure how to properly craft the bits necessary for the Arduino IDE. I copied the NoFire settings, but, well, yeah, didn't work. I'm about ready to walk away from using this board. |
You need to create your target board specification with the right settings to use the right programming parameteters. You need to set:
(or that's if I recall correctly). |
Ok, we have some progress. This is where I'm at:
From my
I'm guessing I'm missing a step. |
@majenkotech also, I went back to MZBoot and changed the pid to match the microchip board.
USBManager USB(usbDriver, 0x04d8, 0x8107, "chipKIT", "HID Bootloader"); You can see I have the same pid/vid combo in the |
Is the board being detected by your operating system? |
Yes, that's how I was able to grab the pid/vid. Further, if I unplug the board while pic32prog is waiting, pic32prog kicks out an error about losing contact. Also, if I run pic32prog from the command line using the line generated by the IDE and change a digit in the pid/vid, I receive an error about not being able to find the board; bad pid/vid. |
I cloned the UART MPLAB config and changed the capabilities in
microchip.h
toblCapUSBInterface
. In looking at the build output for a Fubarino SD USB, I seecdccam.o
. Do I need to make further changes to the MPLAB config for the M7 board to include the necessary USB code? Thanks!The text was updated successfully, but these errors were encountered: