Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mplabx - xc8 and pinguino bootloader with PIC18F2455
18-12-2013, 03:16 AM,
#1
mplabx - xc8 and pinguino bootloader with PIC18F2455
Hello,
I'd like to thank you for the great project - Pinguino and all the work done around.

I spent few days on google, how to simply integrate great (small sized, linux compatible) Pinguino USB bootloader with my fresh installation of mplabx - the first success results you can find bellow.

The first issue was to find how to upload simple, existing hex file without compilation or/and Pinguino IDE usage, I found regis's uploader8.py - only one parameter required - the hex file path, I found it here:
Code:
wget http://pinguino32.googlecode.com/svn/bootloaders/8/usb/v4.x/tools/uploader8.py

The second issue was, how to create compatible hex file in mplabx (screenshots of "LED based Hello World" are selfexplaining - LED on RB7 blinks 10 times, than device reset brings bootloader mode - I'm using Bootloader_v4.14_18f2455_X20MHz.hex).
- disable default cfg words/bits to be included in hex file
- correct linker memory ranges/offset
- custom upload command after successfull project build (optional)

I hope that this "one page info" will help somebody, who wants to integrate old archived projects with nice USB bootloader.
Thank you,
Jozef


Attached Files Thumbnail(s)
                   
Reply
18-12-2013, 09:58 AM,
#2
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
Hi Jozef,
Thank you for these explanations.
There are already articles on the Wiki about how to program a Pinguino board with :
- the SDCC compiler toolchain (without the Pinguino IDE)
- the MikroElektronika toolchain
Would you like to add something about MPLABX and Pinguino ?
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
18-12-2013, 11:33 AM,
#3
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
Great work Josef - a new Wiki article for this would be a very useful addition. See: http://wiki.pinguino.cc/index.php/Main_P...umentation
Reply
18-12-2013, 04:43 PM,
#4
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
Hello,

I will try to make some more testing with complex source code, to see whether it is already working "out of box" because I thing that simple "hello world" is not the proof that it will be working with large projects (Microchip libraries etc.), then I will be able to make step-by-step how-to for the wiki. Right now I'm happy that google will index this first example with related keywords on pinguino home page.

Thank you,
Jozef
Reply
21-12-2013, 11:23 PM,
#5
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
Hello,
let me share with you my successfull "hello worlds" (compiled by xc8 and c18) and success with basic CDC attempt (compiled by c18) from Microchip library with linker file which creates pinguino compatible hex files.

Regards,
Jozef


Attached Files
.gz   c18_pinguino_bootloader_hello_world.X.tar.gz (Size: 18.4 KB / Downloads: 8)
.gz   xc8_pinguino_bootloader_hello_world.X.tar.gz (Size: 88.53 KB / Downloads: 15)
.gz   CDC.X.tar.gz (Size: 193.72 KB / Downloads: 15)
Reply
13-01-2014, 02:07 PM, (This post was last modified: 13-01-2014, 03:52 PM by noefner.)
#6
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
Hello,

to all Linux users:

I was writing a little test code in MPlabX / XC8 for the pic18f24j50 and pic18f26j50 to find out how and if it runs with the pinguino v4.x bootloader.

It came out that there is a little bug in the 'uploader8.py' python script:

The comparison in line #426 is always false if you're using a "j" device due to defined devices in 'devices_table' line #163.
All the "j" devices are defined with an upper case "J", so the uploader script will detect the right MCU but will use the wrong erased blocks size.

This results in a non-working code on the MCU and a no more working bootloader (a read on the flash memory showed up a completely empty rom with 0x0000).

Change the lower case "j" to an upper case "J" or add an 'or "J"' in line #426 and it will work fine:

uploader8.py:
Code:
> #425:    # Pinguino x6j50 or x7j53, erased blocks are 1024-byte long
> #426:    if "j" or "J" in proc :
> #427:        erasedBlockSize = 1024
> #428:
> #429:    # Pinguino x455, x550 or x5k50, erased blocks are 64-byte long
> #430:    else:
> #431:        erasedBlockSize = 64

So long,
Niko.
Reply
13-01-2014, 05:18 PM, (This post was last modified: 13-01-2014, 05:22 PM by regis.)
#7
RE: mplabx - xc8 and pinguino bootloader with PIC18F2455
That's right the stand-alone version of uploader8.py had a bug.
I fixed it just as you said. I also turned all upper case MCU names to lower case ;-)
I will commit the file soon.
Thanks you very much for this report Niko.
Régis

(13-01-2014, 02:07 PM)noefner Wrote: Hello,

to all Linux users:

I was writing a little test code in MPlabX / XC8 for the pic18f24j50 and pic18f26j50 to find out how and if it runs with the pinguino v4.x bootloader.

It came out that there is a little bug in the 'uploader8.py' python script:

The comparison in line #426 is always false if you're using a "j" device due to defined devices in 'devices_table' line #163.
All the "j" devices are defined with an upper case "J", so the uploader script will detect the right MCU but will use the wrong erased blocks size.

This results in a non-working code on the MCU and a no more working bootloader (a read on the flash memory showed up a completely empty rom with 0x0000).

Change the lower case "j" to an upper case "J" or add an 'or "J"' in line #426 and it will work fine:

uploader8.py:
Code:
> #425:    # Pinguino x6j50 or x7j53, erased blocks are 1024-byte long
> #426:    if "j" or "J" in proc :
> #427:        erasedBlockSize = 1024
> #428:
> #429:    # Pinguino x455, x550 or x5k50, erased blocks are 64-byte long
> #430:    else:
> #431:        erasedBlockSize = 64

So long,
Niko.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)