[solved] PINGUINO Bootleader.... thanks MR RUDI
Moderator: Benj
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
[solved] PINGUINO Bootleader.... thanks MR RUDI
hi everyone
haw acn i using Flowcode with the PINGUINO Bootloader
my Cart PInguino is : 18F4550 - 20MHz
i cant programme with PYthon .. i like Flowcode
i was seeing this video about how to use bootloader and flowcode
https://www.youtube.com/watch?v=NFBWHMlCg94
thank you
haw acn i using Flowcode with the PINGUINO Bootloader
my Cart PInguino is : 18F4550 - 20MHz
i cant programme with PYthon .. i like Flowcode
i was seeing this video about how to use bootloader and flowcode
https://www.youtube.com/watch?v=NFBWHMlCg94
thank you
Last edited by mossine on Mon May 30, 2016 2:57 am, edited 2 times in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PINGUINO Bootleader
Hello,
You should just be able to create a Flowcode program and then use the Pinguino software to transfer the hex file created from Flowcode to your hardware.
You might need to shift the hex file to allow for the Pinguino bootloader however there doesn't seem to be much information on this.
For our bootloaders we need to shift the code by either 0x800 or 0x1000.
To do this you can go into the Compiler options and add this to the beginning of the linker parameters
-rb 0x800
where 0x800 is the shift you need.
The linker parameters should end up looking like this.
-rb 0x800 -ld "$(appdir)compilers\pic\boostc\lib" libc_$(family:/12F/16F).lib rand_$(family:/12F/16F).lib float_$(family:/12F/16F).lib "$(target).obj" -t PIC$(chip:u) -d "$(outdir:~-1)" -p "$(target)" -swcs 6 2
The whole idea of the Pinguino is that you can use Arduino style code to program a PIC. If you are using Flowcode then you can talk to the chip directly with a PICkit so the Pinguino bootloader is not necessary.
An ECIO28P or ECIO40P is a 18F2455 and 18F4455 device with USB reprogramming and bootloader built in and ready to go, maybe this would be more suitable?
You should just be able to create a Flowcode program and then use the Pinguino software to transfer the hex file created from Flowcode to your hardware.
You might need to shift the hex file to allow for the Pinguino bootloader however there doesn't seem to be much information on this.
For our bootloaders we need to shift the code by either 0x800 or 0x1000.
To do this you can go into the Compiler options and add this to the beginning of the linker parameters
-rb 0x800
where 0x800 is the shift you need.
The linker parameters should end up looking like this.
-rb 0x800 -ld "$(appdir)compilers\pic\boostc\lib" libc_$(family:/12F/16F).lib rand_$(family:/12F/16F).lib float_$(family:/12F/16F).lib "$(target).obj" -t PIC$(chip:u) -d "$(outdir:~-1)" -p "$(target)" -swcs 6 2
The whole idea of the Pinguino is that you can use Arduino style code to program a PIC. If you are using Flowcode then you can talk to the chip directly with a PICkit so the Pinguino bootloader is not necessary.
An ECIO28P or ECIO40P is a 18F2455 and 18F4455 device with USB reprogramming and bootloader built in and ready to go, maybe this would be more suitable?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
thank you Mr Benj .
i was do the same configuration but its not work
Unlike the microchip bootloader . its work without shifting the code . i think the problem in the Pinguino IDE
this is the Pinguino bootloader : and i shift code by either 0x0A30 and use other 0x1000 -....
the result is nothing
i like to programme with flowcode it's more suitable , but Pinguino bootloader is necessary for me .
i waiting for your help , thank you so much Mr Benj .
cordially mossine
i was do the same configuration but its not work
Unlike the microchip bootloader . its work without shifting the code . i think the problem in the Pinguino IDE
this is the Pinguino bootloader : and i shift code by either 0x0A30 and use other 0x1000 -....
the result is nothing
i like to programme with flowcode it's more suitable , but Pinguino bootloader is necessary for me .
i waiting for your help , thank you so much Mr Benj .
cordially mossine
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone
i'm waiting for news about adapting flowcode with pinguino kits
i hope the developers of flowcode found a solutions .
thanks for all
i'm waiting for news about adapting flowcode with pinguino kits
i hope the developers of flowcode found a solutions .
thanks for all
Re: PINGUINO Bootleader
cheersmossine wrote:hi everyone ..
..and i shift code by either 0x0A30 and use other 0x1000 -....
not sure but give this a try:
Code: Select all
..
# ENTRY address is the end of bootloader / start of user's application
# ENTRY must be a multiple of 1024 because :
# 1/ flash must be erased before any write,
# 2/ some PICs can only erase 1024-byte long blocks
ENTRY = 0x0C00
..
and shift with this try
Code: Select all
-rb 0x0C00
info2
best wishes
rudi
btw which Software "programmer" you use for download the firmware(not bootloader hex)?
did it find the "bootloader" if you push to bootloader mode?
edit: example stand-alone uploader (uploader8.py)
info3
info4
you need then python
other step would be, compile a bootloader ( makefile ) and change the shift address to your need, that would be a second solution.
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone .
thank you for your explanation . To bring the point of my view : i was used the microchip bootloader and use PIC18F4550 it's like pinguino,except some differents ;and sometimes created programmes with MikroC or created with FLOWCODE .Honestly i like programming with flowcode .
when i uploaded the hex file into my kit " 18F4550 starter kit with microship bootloader " ,its works good .
Unlike application on "Pinguino" with Pinguino Bootloader .. its not work ;Although shifting the code to address .
but i think this is the end of my attempts for adapting between flowcode and PINGUINO , because a Developer on Pinguino says that's :
even your explanation i try to know how to applied ..thank you for your explanation
thank you for your explanation . To bring the point of my view : i was used the microchip bootloader and use PIC18F4550 it's like pinguino,except some differents ;and sometimes created programmes with MikroC or created with FLOWCODE .Honestly i like programming with flowcode .
when i uploaded the hex file into my kit " 18F4550 starter kit with microship bootloader " ,its works good .
Unlike application on "Pinguino" with Pinguino Bootloader .. its not work ;Although shifting the code to address .
but i think this is the end of my attempts for adapting between flowcode and PINGUINO , because a Developer on Pinguino says that's :
https://translate.google.comBonsoir Mohssine,
N'espères pas pouvoir uploader des applis FLOWCODE sur un 18f4550 + bootloader v4.14. Après vérification ce bootloader n'a pas été conçu avec cette possibilité.
Utilises plutôt le bootloader Microchip et PDFSUSB.exe pour télécharger les applis Flowcode décalés de 0x0800.
A bientôt
i don't think so . i know it is possible to do this work " adapting " but i'm just a beginner to know all that's ..Do not hope to be able to upload FLOWCODE apps on a 18f4550 bootloader + v4.14. After checking the bootloader was not designed with this possibility.
Rather using the Microchip and PDFSUSB.exe bootloader to download apps Flowcode offset 0x0800.
See you soon
even your explanation i try to know how to applied ..thank you for your explanation
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
i loved creating flowcode programs and upload the hex file of these programs using IDE pinguino: download directly hex option,see below option :by Rudi » Wed May 11, 2016 10:15 pm
btw which Software "programmer" you use for download the firmware(not bootloader hex)?
yes its works will . i was installed pinguino drivers on my computer, i can creating programms with python IDE and upload to pinguino its works .did it find the "bootloader" if you push to bootloader mode?
but i like to try with hex created by flowcode that's the problem
thank you
Re: PINGUINO Bootleader
mossine wrote:Bonsoir Mohssine,
N'espères pas pouvoir uploader des applis FLOWCODE sur un 18f4550 + bootloader v4.14. Après vérification ce bootloader n'a pas été conçu avec cette possibilité.
Utilises plutôt le bootloader Microchip et PDFSUSB.exe pour télécharger les applis Flowcode décalés de 0x0800.
A bientôt
aaahhh
think, i understand now better:
your pinguino uploader works well?
and the shift address is 0x0800 in python ide?
so give this a try:
compile / link ( only this ) in Flowcode with this then:
Code: Select all
-rb 0x0800
if work, then we know, that "0x0800 is your friend"
then you need a flash programm, that support 0x0800 as bootloader. ( mloader is standard in FC , not sure but think support 0x0000 .. 0x1000 ...)
btw using the Microchip and PDFSUSB.exe is possible too, the one that must change is,
that the tool "see at 0x0800" for your application code.
or you can use the pinguino flasher if support by command in flowcode btw.
if pinguino downloader is named "myflasher.py" then if you installed python on your desktop
then you can call "python myflasher.py "yourhexfile.hex"
or with other words:
you can use the environment variables in flowcode too:
so look at "$(outdir)$(target).hex"
thats the hex file that flowcode create.
hope this helps.
best wishes
rudi
Re: PINGUINO Bootleader
other question:
do you want to upload by a bootloader or do you want to flash the chip at 0x0000
the bootloader helps you, to upload a hex file by simple connect the chip with a software flasher
the bootloader must installed first time with flash utentsily like PicKit2, PicKit3 and other.
if the bootloader is installed, then the applicaction code can upload by this helper on the chip.
if you want to upload your created hex file in flowcode without a bootloader, then you flash the hex without a shift address,
but then you need the picKit2, picKit3 or other to connect to the chip by SPI ( ISP ) ..
what do you want to do ?
,,
do you want to upload by a bootloader or do you want to flash the chip at 0x0000
the bootloader helps you, to upload a hex file by simple connect the chip with a software flasher
the bootloader must installed first time with flash utentsily like PicKit2, PicKit3 and other.
if the bootloader is installed, then the applicaction code can upload by this helper on the chip.
if you want to upload your created hex file in flowcode without a bootloader, then you flash the hex without a shift address,
but then you need the picKit2, picKit3 or other to connect to the chip by SPI ( ISP ) ..
what do you want to do ?
,,
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone .
thank you Mr Rudi .
i think the Pinguino drivers installed in windows not compatible with uploaded programmes like : Mloader - Microchip PDFSUSB.exe - FarnellProg ........
thank you Mr Rudi .
that's what i want to do exactly ,
the bootloader helps you, to upload a hex file by simple connect the chip with a software flasher
i try all that before, no change no things workyour pinguino uploader works well?
and the shift address is 0x0800 in python ide?Code: Select all
-rb 0x0800
it was failed trying, with alot of address..then you need a flash programm, that support 0x0800 as bootloader. ( mloader is standard in FC , not sure but think support 0x0000 .. 0x1000 ...)
btw using the Microchip and PDFSUSB.exe is possible too, the one that must change is,
that the tool "see at 0x0800" for your application code.
i think the Pinguino drivers installed in windows not compatible with uploaded programmes like : Mloader - Microchip PDFSUSB.exe - FarnellProg ........
Re: PINGUINO Bootleader
cheers,
src
info version 2 (PIC18F4550)
do you press the reset button on start for "bootloader mode" while Soft Flasher search the devide on VID, PID ?
or how you flash with pinguino ide the hex? have you an extra boot jumper on your board?
you sayed, the pc found the bootloader driver on your system,
can you look at system and device manager that you have a "bootloader" device in device manager and how is this named in the system?
can you post PID and VID of them, too?
than perhabs can use the src from microchips pdfusb and programm "bootloader scanner" on which adress the bootloader on your pinguino is listening.
best wishes
rudi
Code: Select all
When the RESET button is pressed, the bootloader waits until a program is uploaded.
Code: Select all
push the reset button
wait 3 seconds
when the run led is off click on the upload button in Pinguino IDE
After 5 seconds the run led will light, the user program is running
do you press the reset button on start for "bootloader mode" while Soft Flasher search the devide on VID, PID ?
or how you flash with pinguino ide the hex? have you an extra boot jumper on your board?
you sayed, the pc found the bootloader driver on your system,
can you look at system and device manager that you have a "bootloader" device in device manager and how is this named in the system?
can you post PID and VID of them, too?
than perhabs can use the src from microchips pdfusb and programm "bootloader scanner" on which adress the bootloader on your pinguino is listening.
best wishes
rudi
Re: PINGUINO Bootleader
V2
try 0x2000
V3
try 0x0800
V4
try 0x0C00
where you get the bootloader software?
was this on PIC18F4550 installed?
there must be an info, where the APP Start Addresss is
then you can link with -rb APPSTARTADDRESS
in Flowcode your flowcode and if the flash programm support command line
then you can use it like pre post descriped ( example python )
flowcode generally support your way, but you must know,
on which address the bootloader is talking with flash programm
and you must switch to bootoader mode like Press Reset Button.
or ( here in PIC18F2550 ) i push RC2 for bootloader mode
best wishes
rudi
try 0x2000
V3
try 0x0800
V4
try 0x0C00
where you get the bootloader software?
was this on PIC18F4550 installed?
there must be an info, where the APP Start Addresss is
then you can link with -rb APPSTARTADDRESS
in Flowcode your flowcode and if the flash programm support command line
then you can use it like pre post descriped ( example python )
flowcode generally support your way, but you must know,
on which address the bootloader is talking with flash programm
and you must switch to bootoader mode like Press Reset Button.
or ( here in PIC18F2550 ) i push RC2 for bootloader mode
Code: Select all
// example 0x0800
CODEPAGE NAME=apppage START=0x0800 END=0x0801
rudi
Re: PINGUINO Bootleader
have you test the standalone programmer
this is the tool you need for programm the pinguino then in flowcode.
compare your founds in device manager with this:
where
VID = 0x04D8
PID = 0xFEAA
do this match?
then test your programmer from command line,
be sure you have installed python
and your device is in bootloader mode!
so please, link your flowchart in flowcode with -rb 0x0C00
then test, switch to bootloader boot, then run like this...
c:\python27\python c:\yourflashtool\programmer8.py c:\yourhexlocation\flowcode.hex
and here the correct command:
so have a look to the supported devices..
and then if you use the PIC18F4550
c:\python27\python c:\yourflashtool\programmer8.py c:\yourhexlocation\flowcode.hex 18f4550
if not working
you will get "Pinguino not connected", check that you are in bootloader mode
if you get "Pinguino found"
then you make the goal.
solution if not found,
last step that i can give you then,
you can change the PID, VID in py file to your installed in device manager and try again
this where my last inspiration for this .. be sure your device is in bootloader mode! /reset button or like you configured.
best wishes
rudi
ps
do not use the uploader8.py this does not work with microchip modified HID bootloader sources ( last 2 years )
this is the tool you need for programm the pinguino then in flowcode.
compare your founds in device manager with this:
Code: Select all
VENDOR_ID = 0x04D8 # Microchip License
PRODUCT_ID = 0xFEAA # Pinguino Sub-License
VID = 0x04D8
PID = 0xFEAA
do this match?
then test your programmer from command line,
be sure you have installed python
and your device is in bootloader mode!
Code: Select all
memstart = 0x0C00 # bootloader offset
then test, switch to bootloader boot, then run like this...
c:\python27\python c:\yourflashtool\programmer8.py c:\yourhexlocation\flowcode.hex
and here the correct command:
Code: Select all
# Usage: programmer8.py path/filename.hex target
# ex : programmer8.py blink.hex 18f47j53
Code: Select all
# Table with supported USB devices
# device_id:[PIC name, flash size(in bytes), eeprom size (in bytes)]
#-----------------------------------------------------------------------
devices_table = \
{
0x4740: ['18f13k50' , 0x02000, 0x80 ],
0x4700: ['18lf13k50' , 0x02000, 0x80 ],
0x4760: ['18f14k50' , 0x04000, 0xFF ],
0x4720: ['18f14k50' , 0x04000, 0xFF ],
0x2420: ['18f2450' , 0x04000, 0x00 ],
0x1260: ['18f2455' , 0x06000, 0xFF ],
0x2A60: ['18f2458' , 0x06000, 0xFF ],
0x4C00: ['18f24J50' , 0x04000, 0x00 ],
0x4CC0: ['18lf24J50' , 0x04000, 0x00 ],
0x1240: ['18f2550' , 0x08000, 0xFF ],
0x2A40: ['18f2553' , 0x08000, 0xFF ],
0x4C20: ['18f25J50' , 0x08000, 0x00 ],
0x4CE0: ['18lf25J50' , 0x08000, 0x00 ],
0x5C20: ['18f25k50' , 0x08000, 0xFF ],
0x5CA0: ['18lf25k50' , 0x08000, 0xFF ],
0x4C40: ['18f26J50' , 0x10000, 0x00 ],
0x4D00: ['18lf26J50' , 0x10000, 0x00 ],
0x5860: ['18f27j53' , 0x20000, 0x00 ],
0x1200: ['18f4450' , 0x04000, 0x00 ],
0x1220: ['18f4455' , 0x06000, 0x00 ],
0x2A20: ['18f4458' , 0x06000, 0xFF ],
0x4C60: ['18f44J50' , 0x04000, 0x00 ],
0x4D20: ['18lf44J50' , 0x04000, 0x00 ],
0x1200: ['18f4550' , 0x08000, 0xFF ],
0x2A00: ['18f4553' , 0x08000, 0xFF ],
0x4C80: ['18f45J50' , 0x08000, 0x00 ],
0x4D40: ['18lf45J50' , 0x08000, 0x00 ],
0x4CA0: ['18f46J50' , 0x10000, 0x00 ],
0x4D60: ['18f46J50' , 0x10000, 0x00 ],
0x58E0: ['18f47j53' , 0x20000, 0x00 ],
0x4100: ['18f65J50' , 0x08000, 0x00 ],
0x1560: ['18f66J50' , 0x10000, 0x00 ],
0x4160: ['18f66J55' , 0x18000, 0x00 ],
0x4180: ['18f67J50' , 0x20000, 0x00 ],
0x41A0: ['18f85J50' , 0x08000, 0x00 ],
0x41E0: ['18f86J50' , 0x10000, 0x00 ],
0x1F40: ['18f86J55' , 0x18000, 0x00 ],
0x4220: ['18f87J50' , 0x20000, 0x00 ]
}
c:\python27\python c:\yourflashtool\programmer8.py c:\yourhexlocation\flowcode.hex 18f4550
if not working
Code: Select all
while True:
device = getDevice(VENDOR_ID, PRODUCT_ID)
if device == ERR_DEVICE_NOT_FOUND:
print "Pinguino not connected"
else:
print "Pinguino found !"
break
if you get "Pinguino found"
then you make the goal.
solution if not found,
last step that i can give you then,
you can change the PID, VID in py file to your installed in device manager and try again
this where my last inspiration for this .. be sure your device is in bootloader mode! /reset button or like you configured.
best wishes
rudi
ps
do not use the uploader8.py this does not work with microchip modified HID bootloader sources ( last 2 years )
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
sorry for not completing my clarification of my problem because an interruption of net sudden .
the thing who want to complete is uploading a screen capture win my IDE python works .and this is my Pinguino kite :
this are a reports of pinguino IDE :
1 - compile example and upload :
2 - upload directly the same hex file with this option :
without compiling
continued ........
the thing who want to complete is uploading a screen capture win my IDE python works .and this is my Pinguino kite :
this are a reports of pinguino IDE :
1 - compile example and upload :
2 - upload directly the same hex file with this option :
without compiling
continued ........
Last edited by mossine on Fri May 13, 2016 10:41 pm, edited 1 time in total.
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
continued
2 - upload directly the same hex file :
without compiling
upload directly flowcode hex file :
this is the error in msg
To clarify i'm not a developer; just a beginner, and trying to understand your Recommendations.
i use the version V14,4 for pinguino bootloader
this is a video of my Pinguino kite :
https://youtu.be/QkU2xJ5qsSI
thank you for your Mr Rudi . i'm going to try apply your guidance
2 - upload directly the same hex file :
without compiling
upload directly flowcode hex file :
this is the error in msg
To clarify i'm not a developer; just a beginner, and trying to understand your Recommendations.
i use the version V14,4 for pinguino bootloader
this is a video of my Pinguino kite :
https://youtu.be/QkU2xJ5qsSI
thank you for your Mr Rudi . i'm going to try apply your guidance
Re: PINGUINO Bootleader
hi
thank you for infos..
i write just in time short perhabs you are on pc and can use the info:
see the start from 0x00C00
so please have a try in flowcode in link command ( compiler options ) with -rb 0x00C00
i am not sure, because it write from 0x00C00 to 0x08000
but have a try, please.
will write at weekend ( think can be sunday ) again.
best wishes
rudi
thank you for infos..
i write just in time short perhabs you are on pc and can use the info:
see the start from 0x00C00
so please have a try in flowcode in link command ( compiler options ) with -rb 0x00C00
i am not sure, because it write from 0x00C00 to 0x08000
but have a try, please.
will write at weekend ( think can be sunday ) again.
best wishes
rudi
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone .
thank you Mr Rudi .
To inform you . i was opened this subfolders with IDLE :
tools.py
uploader.py
uploader8.py
thank you Mr Rudi .
To inform you . i was opened this subfolders with IDLE :
tools.py
Code: Select all
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import logging
import time
import traceback
########################################################################
class Debugger(object):
""""""
#----------------------------------------------------------------------
@classmethod
def debug_method(self, f):
def inset(*args, **kwaargs):
logging.info("Starting '%s' from '%s'" % (f.__name__, f.__module__))
t1 = time.time()
try:
ret = f(*args, **kwaargs)
except:
logging.info(traceback.format_exc())
return
t2 = time.time()
logging.info("Time spent for '%s': %.2f s" % (f.__name__, t2-t1))
logging.info("Ending '%s'" % f.__name__)
return ret
return inset
Code: Select all
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import usb
import sys
import logging
import os
#import debugger
from ..tools import Debugger
########################################################################
class baseUploader(object):
# Hex format record types
# --------------------------------------------------------------------------
# Data_Record = 00
# End_Of_File_Record = 01
# Extended_Segment_Address_Record = 02
# Start_Segment_Address_Record = 03
# Extended_Linear_Address_Record = 04
# Start_Linear_Address_Record = 05
# Python3 compatibility (octals)
Data_Record = 0o0
End_Of_File_Record = 0o1
Extended_Segment_Address_Record = 0o2
Start_Segment_Address_Record = 0o3
Extended_Linear_Address_Record = 0o4
Start_Linear_Address_Record = 0o5
# Error codes returned by various functions
# --------------------------------------------------------------------------
ERR_NONE = 100
ERR_CMD_ARG = 101
ERR_CMD_UNKNOWN = 102
ERR_DEVICE_NOT_FOUND = 103
ERR_USB_INIT1 = 104
ERR_USB_INIT2 = 105
ERR_USB_OPEN = 106
ERR_USB_WRITE = 107
ERR_USB_READ = 108
ERR_HEX_OPEN = 109
ERR_HEX_STAT = 110
ERR_HEX_MMAP = 111
ERR_HEX_SYNTAX = 112
ERR_HEX_CHECKSUM = 113
ERR_HEX_RECORD = 114
ERR_VERIFY = 115
ERR_EOL = 116
ERR_USB_ERASE = 117
# Configuration
# ----------------------------------------------------------------------
INTERFACE_ID = 0x00
ACTIVE_CONFIG = 0x01
VSC_ACTIVE_CONFIG = 0x02
# # ------------------------------------------------------------------------------
# def __init__(self, hexfile, board):
# self.report = []
# ------------------------------------------------------------------------------
def add_report(self, message):
""" display message in the log window """
self.report.append(message)
# DEBUGGING MESSAGE
logging.info(message)
# ------------------------------------------------------------------------------
def getDevice(self, board):
""" Scans connected USB devices until it finds a Pinguino board """
logging.info("Looking for a Pinguino device ...")
busses = usb.busses()
for bus in busses:
for device in bus.devices:
logging.info("Found device 0x%04X:0x%04X" % (device.idVendor, device.idProduct))
if (device.idVendor, device.idProduct) == (board.vendor, board.product):
"""
self.configuration = device.configurations[0]
logging.info("Configuration = %s" % self.configuration)
self.interface = self.configuration.interfaces[0][0]
logging.info("Interface = %s" % self.interface)
self.endpoints = []
self.pipes = []
for ep in self.interface.endpoints:
self.endpoints.append(ep)
self.pipes.append(ep.address)
"""
if board.bldr == "boot2":
self.ACTIVE_CONFIG = self.VSC_ACTIVE_CONFIG
return device
return self.ERR_DEVICE_NOT_FOUND
# ----------------------------------------------------------------------
def initDevice(self, device):
""" Init a Pinguino device """
handle = device.open()
if handle:
logging.info("OS is %s" % os.getenv("PINGUINO_OS_NAME"))
if os.getenv("PINGUINO_OS_NAME") == "linux":
if device.idProduct == 0x003C: #self.P32_ID:
# make sure the hid kernel driver is not active
# functionality not available on Darwin or Windows
handle.detachKernelDriver(self.INTERFACE_ID)
logging.info("Kernel driver detached")
#handle.setConfiguration(self.configuration)
handle.setConfiguration(self.ACTIVE_CONFIG)
logging.info("Configuration set")
#handle.claimInterface(self.interface)
handle.claimInterface(self.INTERFACE_ID)
logging.info("Interface claimed")
logging.info("Everything OK so far")
return handle
return self.ERR_USB_INIT1
# ------------------------------------------------------------------------------
def closeDevice(self, handle):
""" Close currently-open USB device """
try:
handle.releaseInterface()
except Exception as e:
logging.info(e)
pass
logging.info("Device closed")
########################################################################
class Uploader(object):
"""Universal uploader class"""
#----------------------------------------------------------------------
def __init__(self, hexfile, board):
#debugger.Debugger(sys)
self.hexfile = hexfile
#self.filename = hexfile
self.board = board
if board.bldr == "noboot":
# TODO : interface here something like PICpgm (http://www.members.aon.at/electronics/pic/picpgm/)
#self.logwindow("You choose a board without bootloader.\nYou should either change your board type\nor use a programmer to upload your application on your board", 1)
raise Exception("You choose a board without bootloader.\nYou should either change your board type\nor use a programmer to upload your application on your board")
elif board.bldr == "boot2":
from uploaderVSC import uploaderVSC as Uploader
#elif board.bldr == 'boot3':
# self.uploader = self.uploaderDLN(*parameters)
elif board.bldr == "boot4":
from uploader8 import uploader8 as Uploader
elif board.bldr == "microchip":
from uploader32 import uploader32 as Uploader
#self.uploader = Uploader(hexfile, board)
self.uploader = Uploader()
#----------------------------------------------------------------------
@Debugger.debug_method
def upload(self):
self.uploader.report = []
self.uploader.uploadDevice(self.hexfile, self.board)
return self.uploader.report
uploader8.py
Code: Select all
#!/usr/bin/env python
#-*- coding: iso-8859-15 -*-
"""---------------------------------------------------------------------
Pinguino Universal Uploader
Author: Regis Blanchot <rblanchot@gmail.com>
Last release: 2012-04-20
This library is free software you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
---------------------------------------------------------------------"""
# This class is based on :
# - Diolan USB bootloader licenced (LGPL) by Diolan <http://www.diolan.com>
# - jallib USB bootloader licenced (BSD) by Albert Faber
# See also http://wiki.erazor-zone.de/wiki:projects:python:pyusb:pydoc
# Pinguino Device Descriptors : lsusb -v -d 04d8:feaa
#import sys
import os
#import usb # checked in check.py
from uploader import baseUploader
class uploader8(baseUploader):
""" upload .hex into pinguino device """
# General Data Packet Structure (usbBuf)
# ------------------------------------------------------------------
# __________________
# | COMMAND | 0 [CMD]
# | LEN | 1 [LEN]
# | ADDRL | 2 [ ] [addrl]
# | ADDRH | 3 [ADR.pAdr]: [addrh]
# | ADDRU | 4 [ ] [addru]
# | | 5 [DATA]
# | |
# . DATA .
# . .
# | | 62
# |________________| 63
#
# ------------------------------------------------------------------
BOOT_CMD = 0
BOOT_CMD_LEN = 1
BOOT_ADDR_LO = 2
BOOT_ADDR_HI = 3
BOOT_ADDR_UP = 4
BOOT_DATA_START = 5
BOOT_DEV1 = 5
BOOT_DEV2 = 6
BOOT_VER_MINOR = 2
BOOT_VER_MAJOR = 3
BOOT_SIZE = 1
# Bootloader commands
# ------------------------------------------------------------------
READ_VERSION_CMD = 0x00
READ_FLASH_CMD = 0x01
WRITE_FLASH_CMD = 0x02
ERASE_FLASH_CMD = 0x03
#READ_EEDATA_CMD = 0x04
#WRITE_EEDATA_CMD = 0x05
#READ_CONFIG_CMD = 0x06
#WRITE_CONFIG_CMD = 0x07
RESET_CMD = 0xFF
# Data Block's size to write
# ------------------------------------------------------------------
DATABLOCKSIZE = 32
# USB Packet size
# ------------------------------------------------------------------
MAXPACKETSIZE = 64
# bulk endpoints
# ------------------------------------------------------------------
IN_EP = 0x81 # endpoint for Bulk reads
OUT_EP = 0x01 # endpoint for Bulk writes
# configuration
# ------------------------------------------------------------------
# RB 2015-03-20 : moved to uploader.py
#ACTIVE_CONFIG = 0x01
#INTERFACE_ID = 0x00
TIMEOUT = 10000 # 1200
# Table with Microchip 8-bit USB devices
# device_id:[PIC name]
# ------------------------------------------------------------------
devices_table = \
{
0x4740: ['18f13k50'],
0x4700: ['18lf13k50'],
0x4760: ['18f14k50'],
0x4720: ['18f14k50'],
0x2420: ['18f2450'],
0x1260: ['18f2455'],
0x2A60: ['18f2458'],
0x4C00: ['18f24j50'],
0x4CC0: ['18lf24j50'],
0x5C60: ['18f24k50'],
0x5CE0: ['18lf24k50'],
0x1240: ['18f2550'],
0x2A40: ['18f2553'],
0x4C20: ['18f25j50'],
0x4CE0: ['18lf25j50'],
0x5C20: ['18f25k50'],
0x5CA0: ['18lf25k50'],
0x4C40: ['18f26j50'],
0x4D00: ['18lf26j50'],
0x5860: ['18f27j53'],
0x1200: ['18f4450'],
0x1220: ['18f4455'],
0x2A20: ['18f4458'],
0x4C60: ['18f44j50'],
0x4D20: ['18lf44j50'],
0x1200: ['18f4550'],
0x2A00: ['18f4553'],
0x4C80: ['18f45j50'],
0x4D40: ['18lf45j50'],
0x5C00: ['18f45k50'],
0x5C80: ['18lf45k50'],
0x4CA0: ['18f46j50'],
0x4D60: ['18lf46j50'],
0x58E0: ['18f47j53'],
0x4100: ['18f65j50'],
0x1560: ['18f66j50'],
0x4160: ['18f66j55'],
0x4180: ['18f67j50'],
0x41A0: ['18f85j50'],
0x41E0: ['18f86j50'],
0x1F40: ['18f86j55'],
0x4220: ['18f87j50']
}
# ----------------------------------------------------------------------
def sendCommand(self, handle, usbBuf):
# ----------------------------------------------------------------------
""" send command to the bootloader """
#self.txtWrite('[%s]' % ', '.join(map(hex, usbBuf)))
sent_bytes = handle.bulkWrite(self.OUT_EP, usbBuf, self.TIMEOUT)
#self.txtWrite(str(sent_bytes))
if sent_bytes == len(usbBuf):
#self.txtWrite("Block issued without problem.")
# whatever is returned, USB packet size is always
# 64 bytes long in high speed mode
return handle.bulkRead(self.IN_EP, self.MAXPACKETSIZE, self.TIMEOUT)
return self.ERR_USB_WRITE
# ----------------------------------------------------------------------
def resetDevice(self, handle):
# ----------------------------------------------------------------------
""" reset device """
#usbBuf = [self.RESET_DEVICE_CMD] * self.MAXPACKETSIZE
usbBuf = [0] * self.MAXPACKETSIZE
# command code
usbBuf[self.BOOT_CMD] = self.RESET_CMD
# write data packet
#usbBuf = self.sendCommand(usbBuf)
try:
handle.bulkWrite(self.OUT_EP, usbBuf, self.TIMEOUT)
except:
return self.ERR_USB_WRITE
return self.ERR_NONE
# ----------------------------------------------------------------------
def getVersion(self, handle):
# ----------------------------------------------------------------------
""" get bootloader version """
usbBuf = [0] * self.MAXPACKETSIZE
# command code
usbBuf[self.BOOT_CMD] = self.READ_VERSION_CMD
# write data packet and get response
usbBuf = self.sendCommand(handle, usbBuf)
if usbBuf == self.ERR_USB_WRITE :
return self.ERR_USB_WRITE
# major.minor
return str(usbBuf[self.BOOT_VER_MAJOR]) + "." + \
str(usbBuf[self.BOOT_VER_MINOR])
# ----------------------------------------------------------------------
def getDeviceID(self, handle):
# ----------------------------------------------------------------------
""" read 2-byte device ID from location 0x3FFFFE """
usbBuf = self.readFlash(handle, 0x3FFFFE, 2)
if usbBuf == self.ERR_USB_WRITE:
return self.ERR_USB_WRITE
#print "BUFFER =", usbBuf
dev1 = usbBuf[self.BOOT_DEV1]
#print "DEV1 =", dev1
dev2 = usbBuf[self.BOOT_DEV2]
#print "DEV2 =", dev2
device_id = (int(dev2) << 8) + int(dev1)
#print device_id
device_rev = device_id & 0x001F
# mask revision number
return device_id & 0xFFE0
# ----------------------------------------------------------------------
def getDeviceName(self, device_id):
# ----------------------------------------------------------------------
for n in self.devices_table:
if n == device_id:
return self.devices_table[n][0]
return self.ERR_DEVICE_NOT_FOUND
# ----------------------------------------------------------------------
def eraseFlash(self, handle, address, numBlocks):
# ----------------------------------------------------------------------
""" erase numBlocks of flash memory """
usbBuf = [0] * self.MAXPACKETSIZE
# command code
usbBuf[self.BOOT_CMD] = self.ERASE_FLASH_CMD
# number of blocks to erase
usbBuf[self.BOOT_SIZE] = numBlocks
# block address
usbBuf[self.BOOT_ADDR_LO] = (address ) & 0xFF
usbBuf[self.BOOT_ADDR_HI] = (address >> 8 ) & 0xFF
usbBuf[self.BOOT_ADDR_UP] = (address >> 16) & 0xFF
# write data packet
#return self.sendCommand(usbBuf)
handle.bulkWrite(self.OUT_EP, usbBuf, self.TIMEOUT)
# ----------------------------------------------------------------------
def readFlash(self, handle, address, length):
# ----------------------------------------------------------------------
""" read a block of flash """
usbBuf = [0] * self.MAXPACKETSIZE
# command code
usbBuf[self.BOOT_CMD] = self.READ_FLASH_CMD
# size of block in bytes
usbBuf[self.BOOT_CMD_LEN] = length
# address of the block
usbBuf[self.BOOT_ADDR_LO] = (address ) & 0xFF
usbBuf[self.BOOT_ADDR_HI] = (address >> 8 ) & 0xFF
usbBuf[self.BOOT_ADDR_UP] = (address >> 16) & 0xFF
# send request to the bootloader
return self.sendCommand(handle, usbBuf)
#handle.bulkWrite(self.OUT_EP, usbBuf, self.TIMEOUT)
#return handle.bulkRead(self.IN_EP, self.BOOT_DATA_START + length, self.TIMEOUT)
# ----------------------------------------------------------------------
def writeFlash(self, handle, address, datablock):
# ----------------------------------------------------------------------
""" write a block of code
first 5 bytes are for block description (BOOT_CMD, BOOT_CMD_LEN and BOOT_ADDR)
data block size should be of DATABLOCKSIZE bytes
total length is then DATABLOCKSIZE + 5 """
usbBuf = [0xFF] * self.MAXPACKETSIZE
# command code
usbBuf[self.BOOT_CMD] = self.WRITE_FLASH_CMD
# size of block
usbBuf[self.BOOT_CMD_LEN] = len(datablock)
# block's address
usbBuf[self.BOOT_ADDR_LO] = (address ) & 0xFF
usbBuf[self.BOOT_ADDR_HI] = (address >> 8 ) & 0xFF
usbBuf[self.BOOT_ADDR_UP] = (address >> 16) & 0xFF
# add data to the packet
#self.txtWrite(hex(address))
for i in range(len(datablock)):
#self.txtWrite(hex(datablock[i]))
usbBuf[self.BOOT_DATA_START + i] = datablock[i]
# write data packet on usb device
handle.bulkWrite(self.OUT_EP, usbBuf, self.TIMEOUT)
#print usbBuf
#usbBuf = self.sendCommand(usbBuf)
#print usbBuf
#if usbBuf == self.ERR_USB_WRITE :
# self.txtWrite("Write error")
# ----------------------------------------------------------------------
def writeHex(self, handle, filename, board):
# ----------------------------------------------------------------------
""" Parse the Hex File Format and send data to usb device """
"""
[0] Start code, one character, an ASCII colon ':'.
[1:3] Byte count, two hex digits, a number of bytes (hex digit pairs) in the data field. 16 (0x10) or 32 (0x20) bytes of data are the usual compromise values between line length and address overhead.
[3:7] Address, four hex digits, a 16-bit address of the beginning of the memory position for the data. Limited to 64 kilobytes, the limit is worked around by specifying higher bits via additional record types. This address is big endian.
[7:9] Record type, two hex digits, 00 to 05, defining the type of the data field.
[9:*] Data, a sequence of n bytes of the data themselves, represented by 2n hex digits.
[*:*] Checksum, two hex digits - the least significant byte of the two's complement of the sum of the values of all fields except fields 1 and 6 (Start code ":" byte and two hex digits of the Checksum). It is calculated by adding together the hex-encoded bytes (hex digit pairs), then leaving only the least significant byte of the result, and making a 2's complement (either by subtracting the byte from 0x100, or inverting it by XOR-ing with 0xFF and adding 0x01). If you are not working with 8-bit variables, you must suppress the overflow by AND-ing the result with 0xFF. The overflow may occur since both 0x100-0 and (0x00 XOR 0xFF)+1 equal 0x100. If the checksum is correctly calculated, adding all the bytes (the Byte count, both bytes in Address, the Record type, each Data byte and the Checksum) together will always result in a value wherein the least significant byte is zero (0x00).
For example, on :0300300002337A1E
03 + 00 + 30 + 00 + 02 + 33 + 7A = E2, 2's complement is 1E
"""
data = []
old_address = 0 # or board.memstart ?
max_address = 0
address_Hi = 0
codesize = 0
# size of erased block
# --------------------------------------------------------------
# Pinguino x6j50 or x7j53, erased blocks are 1024-byte long
if ("j" or "J") in board.proc :
#self.add_report("x6j50, x6j53 or x7j53 chip")
erasedBlockSize = 1024
# Pinguino x455, x550 or x5k50, erased blocks are 64-byte long
else:
#self.add_report("x455, x550 or x5k50 chip")
erasedBlockSize = 64
# image of the whole PIC memory (above memstart)
# --------------------------------------------------------------
for i in range(board.memend - board.memstart):
data.append(0xFF)
# read hex file
# --------------------------------------------------------------
hexfile = open(filename,'r')
lines = hexfile.readlines()
hexfile.close()
# calculate checksum and max_address
# --------------------------------------------------------------
for line in lines:
byte_count = int(line[1:3], 16)
# lower 16 bits (bits 0-15) of the data address
address_Lo = int(line[3:7], 16)
record_type= int(line[7:9], 16)
# checksum calculation
end = 9 + byte_count * 2 # position of checksum at end of line
checksum = int(line[end:end+2], 16)
cs = 0
i = 1
while i < end:
cs = cs + (0x100 - int(line[i:i+2], 16) ) & 0xff # not(i)
i = i + 2
if checksum != cs:
return self.ERR_HEX_CHECKSUM
# extended linear address record
if record_type == self.Extended_Linear_Address_Record:
# upper 16 bits (bits 16-31) of the data address
address_Hi = int(line[9:13], 16) << 16
# data record
elif record_type == self.Data_Record:
address = address_Hi + address_Lo
# max address
if (address > old_address) and (address < board.memend):
max_address = address + byte_count
old_address = address
# code size
if (address >= board.memstart) and (address < board.memend):
codesize = codesize + byte_count
# data append
for i in range(byte_count):
#Caution : addresses are not always contiguous
#data.append(int(line[9 + (2 * i) : 11 + (2 * i)], 16))
data[address - board.memstart + i] = int(line[9 + (2 * i) : 11 + (2 * i)], 16)
# end of file record
elif record_type == self.End_Of_File_Record:
break
# unsupported record type
else:
return self.ERR_HEX_RECORD
# max_address must be divisible by self.DATABLOCKSIZE
# --------------------------------------------------------------
max_address = max_address + erasedBlockSize - (max_address % erasedBlockSize)
# erase memory from board.memstart to max_address
# --------------------------------------------------------------
numBlocksMax = (board.memend - board.memstart) / erasedBlockSize
numBlocks = (max_address - board.memstart) / erasedBlockSize
if numBlocks > numBlocksMax:
return self.ERR_USB_ERASE
if numBlocks < 256:
self.eraseFlash(handle, board.memstart, numBlocks)
else:
numBlocks = numBlocks - 255
upperAddress = board.memstart + 255 * erasedBlockSize
# from board.memstart to board.memstart + 255 x 64 = 0x3FC0
self.eraseFlash(handle, board.memstart, 255)
# erase flash memory from board.memstart + 0x3FC0 to max_address
self.eraseFlash(handle, upperAddress, numBlocks)
# write blocks of DATABLOCKSIZE bytes
# --------------------------------------------------------------
for addr in range(board.memstart, max_address, self.DATABLOCKSIZE):
index = addr - board.memstart
self.writeFlash(handle, addr, data[index:index+self.DATABLOCKSIZE])
self.add_report("%d bytes written." % codesize)
return self.ERR_NONE
# ----------------------------------------------------------------------
#def writeHex(self):
def uploadDevice(self, filename, board):
# ----------------------------------------------------------------------
# check file to upload
# --------------------------------------------------------------
if filename == '':
self.add_report("No program to write")
self.closeDevice(handle)
return
hexfile = open(filename, 'r')
if hexfile == "":
self.add_report("Unable to open %s" % filename)
return
hexfile.close()
# search for a Pinguino board
# --------------------------------------------------------------
device = self.getDevice(board)
if device == self.ERR_DEVICE_NOT_FOUND:
self.add_report("Pinguino not found")
self.add_report("If your device is connected,")
self.add_report("press the Reset button to switch to bootloader mode.")
return
self.add_report("Pinguino found ...")
handle = self.initDevice(device)
if handle == self.ERR_USB_INIT1:
self.add_report("Upload not possible")
self.add_report("Try to restart the bootloader mode")
return
# find out the processor
# --------------------------------------------------------------
device_id = self.getDeviceID(handle)
proc = self.getDeviceName(device_id)
self.add_report(" - with PIC%s (id=%X)" % (proc, device_id))
if proc != board.proc:
self.add_report("Aborting: program compiled for %s but device has %s" % (board.proc, proc))
self.closeDevice(handle)
return
# find out flash memory size
# --------------------------------------------------------------
memfree = board.memend - board.memstart;
self.add_report(" - with %d bytes free (%d KB)" % (memfree, memfree/1024))
self.add_report(" from 0x%05X to 0x%05X" % (board.memstart, board.memend))
# find out bootloader version
# --------------------------------------------------------------
#product = handle.getString(device.iProduct, 30)
#manufacturer = handle.getString(device.iManufacturer, 30)
self.add_report(" - with USB bootloader v%s" % self.getVersion(handle))
# start writing
# --------------------------------------------------------------
self.add_report("Uploading user program ...")
status = self.writeHex(handle, filename, board)
if status == self.ERR_HEX_RECORD:
self.add_report("Aborting: record error")
self.closeDevice(handle)
return
elif status == self.ERR_HEX_CHECKSUM:
self.add_report("Aborting: checksum error")
self.closeDevice(handle)
return
elif status == self.ERR_USB_ERASE:
self.add_report("Aborting: erase error")
self.closeDevice(handle)
return
elif status == self.ERR_NONE:
self.add_report(os.path.basename(filename) + " successfully uploaded")
# reset and start start user's app.
# --------------------------------------------------------------
#self.txtWrite("Resetting ...")
self.add_report("Starting user program ...")
self.resetDevice(handle)
self.closeDevice(handle)
return
else:
self.add_report("Aborting: unknown error")
return
# ----------------------------------------------------------------------
Re: PINGUINO Bootleader
hi
few question preview, perhabs this helps
do you want to use the arduino bootloader in furter time or can this be replaced? can you replace it? have you an ISP programmer? btw you can flash a new bootloader with arduino too.
if you replace it, you can use then the original bootloader from mchp (microchip) and flash it in fc by command tool. have a look into the flowcode folder "tools"
like you posted, you have found the "soft-flasher" progs.
what you want to do? ( must be possible)
a)
use the pinguino bootloader,
develop in pinguino ide, develop in flowcode
upload(download) hex file in pinguino id
uoload(download) hex file in flowcode
b)
use a neutral (HID) bootloader,
develop in flowcode
upload(download) hex file in flowcode
thanks for infos
best wishes
rudi
few question preview, perhabs this helps
do you want to use the arduino bootloader in furter time or can this be replaced? can you replace it? have you an ISP programmer? btw you can flash a new bootloader with arduino too.
if you replace it, you can use then the original bootloader from mchp (microchip) and flash it in fc by command tool. have a look into the flowcode folder "tools"
like you posted, you have found the "soft-flasher" progs.
what you want to do? ( must be possible)
a)
use the pinguino bootloader,
develop in pinguino ide, develop in flowcode
upload(download) hex file in pinguino id
uoload(download) hex file in flowcode
b)
use a neutral (HID) bootloader,
develop in flowcode
upload(download) hex file in flowcode
thanks for infos
best wishes
rudi
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone
hi Mr . Rudi how are you?
pinguino = PIC microchip
aurduino = ATMEL
yes i have an ISP programmer, i'm going to flash a second PIC18F4550 with bootloader from microchips pdfusb. its work very well with flowcode -MicroC ........
develop in pinguino ide, develop in flowcode
upload(download) hex file in pinguino ide " derect uploading" : this IDE contains an option to upload directly to PINGUINO , it's like pdfusb from microchip ..
thank you so much Mr Rudi ..
hope a nice time
hi Mr . Rudi how are you?
i cant use arduino bootloader as you know it's a hard défferent in architecture.do you want to use the arduino bootloader in furter time or can this be replaced? can you replace it? have you an ISP programmer? btw you can flash a new bootloader with arduino too.
if you replace it, you can use then the original bootloader from mchp (microchip) and flash it in fc by command tool. have a look into the flowcode folder "tools"
pinguino = PIC microchip
aurduino = ATMEL
yes i have an ISP programmer, i'm going to flash a second PIC18F4550 with bootloader from microchips pdfusb. its work very well with flowcode -MicroC ........
use the pinguino bootloader,what you want to do? ( must be possible)
develop in pinguino ide, develop in flowcode
upload(download) hex file in pinguino ide " derect uploading" : this IDE contains an option to upload directly to PINGUINO , it's like pdfusb from microchip ..
thank you so much Mr Rudi ..
hope a nice time
Re: PINGUINO Bootleader
hi mohssine, thanks, i am fine, hope you are the same.mossine wrote:hi everyone
hi Mr . Rudi how are you?
let us see, what the point of the not working in downloading it is.
hope we get a solution in this thread
but I am very confident, that we get this to work.
I'm sorry for the confusion.mossine wrote:i cant use arduino bootloader as you know it's a hard défferent in architecture.do you want to use the arduino bootloader in furter time or can this be replaced? can you replace it? have you an ISP programmer? btw you can flash a new bootloader with arduino too.
if you replace it, you can use then the original bootloader from mchp (microchip) and flash it in fc by command tool. have a look into the flowcode folder "tools"
pinguino = PIC microchip
aurduino = ATMEL
I meant: if no ISP is programmer for disposal, you can also use an Arduino as ISP programmer to programm the PIC.
info 1
info 2 (picture shows programm an atmel-same you can do for programm a PIC )
ok, this is the best solutionmossine wrote: yes i have an ISP programmer, i'm going to flash a second PIC18F4550 with bootloader from microchips pdfusb. its work very well with flowcode -MicroC ........
ok, let me try to do the same things like you want to do.mossine wrote:use the pinguino bootloader,what you want to do? ( must be possible)
develop in pinguino ide, develop in flowcode
upload(download) hex file in pinguino ide " derect uploading" : this IDE contains an option to upload directly to PINGUINO , it's like pdfusb from microchip ..
thank you so much Mr Rudi ..
hope a nice time
i will organcice pinguino ide on a pc, pic 18F2550 is already here.
dont know when i can do this, ( this week ) and let you know how i can help you. hope this is ok.
i am honest, i have not do direct uploading in pinguino IDE, so i hope i have not to much promissed
but i think this must go on at this (double) way.
thank you for feedback.
have a nice time
best wishes
rudi
other info
last but not least
-
- Posts: 35
- Joined: Mon Jun 17, 2013 2:09 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: PINGUINO Bootleader
hi everyone
hi Mr Rudi ?
thank you for your help .
i hope that's too .. ihop go on at double programming way. PInguino - FLowcode
have a nice and great times .
hi Mr Rudi ?
thank you for your help .
i hope that's too .. ihop go on at double programming way. PInguino - FLowcode
have a nice and great times .
Re: PINGUINO Bootleader
mossine wrote:hi everyone
hi Mr Rudi ?
thank you for your help .
i hope that's too .. ihop go on at double programming way. PInguino - FLowcode
have a nice and great times .
hi mohssine,
..short interim result
I am still in the process ..
..had many problems with the installer..i had installed python 2.7 but the installer said allways, there is no python installed..
then pyUSB stopped all .. and other things.
after several hours .. i get the first thing solved. the installer is not good.
and pyUSB better to install before install the installer!
i get pyUSB from here: github
now we can go on step by step
the board is ready
the bootloader is ready
the first blinky compile and upload from ide.
now i will start to try what you want to do.
please, it can be duration perhabs to saturday,
i will have a look just in time and try at friday the rest.
now is all installed for a go on.
why this so complicated to install with the installer?
installer is up2date but why this installer do not find pyUSB?
btw witch version 11/12 and which compiler you use?
best wishes
rudi
Re: PINGUINO Bootleader
append..
for flashing i used PicKit3 and Universal zero ziffs for the pinguino Bootloader .
I use the PIC18F2550 20Mhz Version 4x let me play with this now.
Next post comes with solution or a huge trouble
there is only this or that, and even one goal:
it must work.
best wishes
rudi
for flashing i used PicKit3 and Universal zero ziffs for the pinguino Bootloader .
I use the PIC18F2550 20Mhz Version 4x let me play with this now.
Next post comes with solution or a huge trouble
there is only this or that, and even one goal:
it must work.
best wishes
rudi
Re: PINGUINO Bootleader
edit:
made in Flowcode, upload in pinguino IDE
morning.
try in flowcode in linker option
and try direct download this hex file from pinguino ide
get you mistake in python debug shell or all green
the second part i do not know just in time how we can solve this
ide v11 do not run again after restart without close and open user account and v12 missing compiler files/paths
try later more..
best wishes
rudi
made in Flowcode, upload in pinguino IDE
morning.
try in flowcode in linker option
Code: Select all
-rb 0xC00
get you mistake in python debug shell or all green
the second part i do not know just in time how we can solve this
ide v11 do not run again after restart without close and open user account and v12 missing compiler files/paths
try later more..
best wishes
rudi
Last edited by Rudi on Fri May 20, 2016 12:19 pm, edited 1 time in total.
Re: PINGUINO Bootleader
edit:
made in Flowcode, upload in Flowcode by uploader8.py (tool from pinguino IDE)
you need runing python in a stable environment
sugg: use supplementary code for #pragma code
edit:
use uploader8.py in flowcode if you want to upload directly
only one parameter is need! the hexfile
use complety python path if you have python not in the environment path
and call uploader8.py with completly path too
..
- disable default cfg words / bits to be included in the hex file
..
- correct linker memory ranges / offset
..
- custom upload command after successfull project build (this is optional)
..
let me know how you get on it
happy coding & nice weekend!
Hooray, the weekend is saved.
Hourra, le week-end est enregistré.
best wishes
rudi
btw: this gives me the hint
example
last but not least:
edit(20.05.2016-23:55):
std output
pic18f2550
"setting interrupt vector addresses 0xc00"
so pic18f2550 in FC done with : -rb 0xC00
( if you use the boostc )
std output
pic18f4550
"setting interrupt vector addresses 0xc00"
so pic18f4550 in FC done with : -rb 0xC00
(if you use the boostc)
too.
// edit
made in Flowcode, upload in Flowcode by uploader8.py (tool from pinguino IDE)
you need runing python in a stable environment
sugg: use supplementary code for #pragma code
Code: Select all
// example: 18F2455 full..(you need only #pragmas )
#include <p18f2455.h>
/* --- BEGIN: changes required for bootloader ------------------------------ */
extern void _startup (void); // See c018i.c in your C18 compiler dir
#pragma code _RESET_INTERRUPT_VECTOR = 0x000C00
void _reset (void)
{
_asm goto _startup _endasm
}
#pragma code
#pragma code _HIGH_INTERRUPT_VECTOR = 0x000C08
void _high_ISR (void)
{
;
}
#pragma code _LOW_INTERRUPT_VECTOR = 0x000C18
void _low_ISR (void)
{
;
}
/* --- END: changes required for bootloader -------------------------------- */
use uploader8.py in flowcode if you want to upload directly
only one parameter is need! the hexfile
Code: Select all
$(target).hex
and call uploader8.py with completly path too
..
- disable default cfg words / bits to be included in the hex file
..
- correct linker memory ranges / offset
..
- custom upload command after successfull project build (this is optional)
..
let me know how you get on it
happy coding & nice weekend!
Hooray, the weekend is saved.
Hourra, le week-end est enregistré.
best wishes
rudi
btw: this gives me the hint
example
Code: Select all
#pragma config PLLDIV = 5 // (20 MHz crystal on PICDEM FS USB board)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON //USB Voltage Regulator
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = OFF
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
// #pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
// #pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
// #pragma config CP2 = OFF
// #pragma config CP3 = OFF
#pragma config CPB = OFF
// #pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
// #pragma config WRT2 = OFF
// #pragma config WRT3 = OFF
#pragma config WRTB = OFF // Boot Block Write Protection
#pragma config WRTC = OFF
// #pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
// #pragma config EBTR2 = OFF
// #pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
edit(20.05.2016-23:55):
std output
pic18f2550
"setting interrupt vector addresses 0xc00"
so pic18f2550 in FC done with : -rb 0xC00
( if you use the boostc )
Code: Select all
Processor: 18f2550
sdcc: Calling linker...
+ C:\pinguino\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino\v11\p8\lkr\boot4.18f2550.lkr -m -w -r -o "C:\pinguino\v11\user\source\main.hex" "C:\pinguino\v11\user\source\main.o" "libio18f2550.lib" "libdev18f2550.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f2550.lib" "libsdcc.lib"
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:697 setting interrupt vector addresses 0xc00
std output
pic18f4550
"setting interrupt vector addresses 0xc00"
so pic18f4550 in FC done with : -rb 0xC00
(if you use the boostc)
too.
Code: Select all
Processor: 18f4550
sdcc: Calling linker...
+ C:\pinguino\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino\v11\p8\lkr\boot4.18f4550.lkr -m -w -r -o "C:\pinguino\v11\user\source\main.hex" "C:\pinguino\v11\user\source\main.o" "libio18f4550.lib" "libdev18f4550.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f4550.lib" "libsdcc.lib"
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:697 setting interrupt vector addresses 0xc00