RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Jul 18, 2019 2:42 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Thu Jan 16, 2014 7:06 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Christian, you have to flash the bootloader with pickit2 or pickit3 programmer. The pic32prog supports pickit2 afaik. After that you can upload the unix.hex directly via usb.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Thu May 01, 2014 7:22 am 

Joined: Thu May 01, 2014 7:17 am
Posts: 8
My original message, as my username, seem to keep disappearing. So I re-registered - again.

The question was: The fubarino appears to be a nice platform for this, and apparently (looking at the git/svn code) is supported. It's just that no one talks much about this board.

I would be happy to write a from-scratch-to-RetroBSD doc for this particular board, but I am failing in installing the bootloader on the fubarino itself.

Could you please elaborate a bit more on which version of pickit (not just 2 or 3, but the exact version, under which OS), what exact unix.hex (where to download? How to build?) you used? From there the rest should be a walk in the park, but I am very much stuck here.

Thanks!


Top
 Profile  
 
PostPosted: Sun May 04, 2014 5:07 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Quote:
I would be happy to write a from-scratch-to-RetroBSD doc for this particular board, but I am failing in installing the bootloader on the fubarino itself.

Yea, such documentation would be handy :)
You have to install the dev environment and to build the bootloader.hex, unix.hex and filesystem first.
I use pickit2 for flashing the bootloader. Then you may upload the unix.hex via the usb bootloader (via pic32prog).
The master does include the basic FUBARINO (FUBARINO) and the most advanced FUBARINOBIG (FUBARINO-UART2CONS-UART1-SRAMC) configuration (in /sys/pic32/fubarino).
With "make" you get unix.hex and bootloader.hex in the /sys/pic32/fubarino.
You have to setup the top Makefile.user - for example:
Code:
# Select target board
TARGET                  = $(FUBARINOBIG)

# Filesystem and swap sizes.
FS_KBYTES       = 128000
U_KBYTES        = 20000
SWAP_KBYTES     = 2048

# Set this to the device name for your SD card.  With this
# enabled you can use "make installfs" to copy the filesys.img
# to the SD card.

SDCARD          = /dev/sdb


The typical fubarino config:
Code:
# Fubarino SD with UART2 console, UART1 enabled
#
core pic32mx7

# ! pin numbers here are the pin Ns. printed out on Fubarino board (ie. 12, 23)
mapping fubarino

linker bootloader

# 4MB CPLD sram ramdisk, BB, swap and filesystem, ! nmount=3 (rootfs+swap+tmpfs)
#option PARTITION=sramc0:sa@1500,fs@2572
#option PARTITION=sramc0:sa@1024,fs@3000
#device sramc data=16 lda=5 rd=15 wr=14

# 8MB CPLD sram ramdisk, PMP bus, swap and filesystem
# ! nmount=4 (rootfs+swap+tmp0+tmp1)
# change the sramc-size in rd_sramc.c as well
# no pins defs - using PMP bus, PMA0 (disk0)and PMA10 (disk1) are the PMP addresses
#option PARTITION=sramc0:sa@2048,fs@6144 sramc1:fs@8192
# you must create /tmp0 and tmp1 on the root manualy
# mkdir /tmp0, mkdir /tmp1, mount -a
#device sramc0
#device sramc1

option nmount=2

device kernel cpu_khz=80000 bus_khz=80000 led=21

# Console UART2, tty = UART-1
device console device=tty1
device uart2 baud=115200

# Additional UART1
device uart1 baud=115200

# SDcard
device sd0 port=2 cs=SS mhz=20

# NPROC=25 MAX
option nproc=25
option hz=50
option nbuf=8

device adc
device spi
device oc
device gpio

# Bootloader section:

device bootloader led=21 button=23 crystal=8 jump=0x9d000000
# clock = crystal / pllidiv * pllmul
# usb == 48MHz = crystal / upllidiv * 12

# Bootloader: for 40MHz clock:
# option crystal=8
# option pllidiv=3
# option pllmul=15
# option upllidiv=2

# Bootloader: for 80MHz clock:
option crystal=8
option pllidiv=2
option pllmul=20
option upllidiv=2

# Bootloader: for 96MHz clock:
# option crystal=8
# option pllidiv=2
# option pllmul=24
# option upllidiv=2

# Bootloader: for 120MHz clock:
#option crystal=8
#option pllidiv=1
#option pllmul=15
#option upllidiv=2

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon May 05, 2014 3:00 pm 

Joined: Thu May 01, 2014 7:17 am
Posts: 8
I'm bad at this.

I successfully built retrobsd's bootloader.hex with an Ubuntu virtual machine. I successfully built pic32prog there, too.
pic32prog keeps telling me

Code:
root@vubuntix:~/retrobsd# pic32prog-read-only/pic32prog
Programmer for Microchip PIC32 microcontrollers, Version 1.96
    Copyright: (C) 2011-2014 Serge Vakulenko

No target found.
root@vubuntix:~/retrobsd#


so I installed the MPIDE from microchip, hoping I could use the included avrdude - to no avail:
avrdude seems to recognize the fubarino in it's Stk500v2 mode:

Code:
$  Desktop/Mpide.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Users/cts/Desktop/Mpide.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -p32MX795F512H -cstk500v2 -P/dev/tty.usbmodemfa131 -b115200

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x504943
avrdude: safemode: Fuses OK
avrdude done.  Thank you.
$


But trying to burn the above generated hex file gives a timeout:


Code:
$  Desktop/Mpide.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Users/cts/Desktop/Mpide.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -p32MX795F512H -cstk500v2 -P/dev/tty.usbmodemfa131 -b115200 -D -Uflash:w:Desktop/fubarino/bootloader.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x504943
avrdude: reading input file "Desktop/fubarino/bootloader.hex"
avrdude: writing flash (12288 bytes):

Writing |                                                    | 0% 0.00savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
(...)
^C


Any ideas how to born the bootloader on to the fubarino SD, anyone? I'd be grateful for any input...


Top
 Profile  
 
PostPosted: Mon May 05, 2014 7:46 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
You need pickit2 or pickit3 programmer.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Tue May 06, 2014 1:16 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi all,

I am not sure how low-level you want to go?

Certainly buying a pre-done solution is what most folks do.

I wanted to be able to cold program my pic32s. Meaning they could have any contents and my programmer would get them up and running. So I found an open source j-tag programer. Got it running on the parallel port of an old Pentium.

I was eventually able to get it to cold program any pic32 :). I then wrote a peek/poke type debugger running over this j-tag link.I could erase and reprogram any bits inside. Clock bits, Flash memory, and RAM memory. I wrote a script to program flash (it is VERY slow).

Now I am thinking of porting the j-tag part \to the pic32 itself.

If you want a turn key solution, A large number of folks use the MAX32 board. I have one too. Most folks use some sort of usb programer. Max 32 had that built-in. And hook up to a stock IDE. Easiest way to get up and running.

I also have two pic32 systems built from chips. No commercial board at all. If you want to build your own product this is THE way to go. That said j-tag is also needed. Otherwise how are you going to load or repair the boot loader or the clock bits? Just so you know. There is a trick to get things started if the clock bits begin in the wrong state. This doesn't usually happen! But it DOES occasionally happen.

Lots of fun :).

I hope this makes sense to you?

Good luck.

Questions welcome.

Wiz


Top
 Profile  
 
PostPosted: Wed May 07, 2014 7:17 am 

Joined: Thu May 01, 2014 7:17 am
Posts: 8
Ahh, I see. So, there's no way to flash the RetroBSD bootloader on to a "naked" fubarino, ie. via it's already burned bootloader (the one that identifies itself as Stk500v2) via USB?


Top
 Profile  
 
PostPosted: Wed May 07, 2014 5:19 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
There is not, afaik..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon May 12, 2014 1:37 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi cts,

Many manufacturers effectively tie you to THEIR version by either buying chips with a 'bootloader' preprogramed or by putting in their own bootloader and then not making the sources available.

Even given the full sources it can be non-trivial to get things going :).

Patching is also tacky. IIRC you can only erase 4k blocks and then program the all zero bits to a one.

And you cannot be running from the portion being programmed so you need to have two programming routines or have a load the burner into RAM and run from there.

HTH

Wiz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission