RetroBSD
http://retrobsd.org/

4.4bsd boot in multi-user mode on pic32mz
http://retrobsd.org/viewtopic.php?f=14&t=37077
Page 7 of 10

Author:  vak [ Sun Dec 28, 2014 1:11 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Very good. I hope, this board will be eventually available at your Ebay store.

USB bootloader for MZ is a critical point for now. It would be great to have Microchip USB stack available under BSD (or Apache) license - we could reuse it for RetroBSD as well.

External FT232 adapter is OK for me. Another useful peripheral would be an RTC clock (like PCF8563).

I've contacted Microchip, and they kindly donated an elaborated board (https://github.com/sergev/LiteBSD/wiki/ ... B-II-board) for a support of 4.4bsd project. It has Ethernet port and Wi-Fi module, and a lot of other interesting peripherals. I doubt we can utilize LCD display, as it would require too much dedicated RAM, but other functions seem quite usable (audio, camera, accelerometer, temperature sensor, external SRAM and serial Flash memory).

I'm now working on Ethernet driver.

Author:  gewtnet [ Sun Dec 28, 2014 5:21 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

I gotta get an Ethernet one...Love the Wi-Fire I have...but Ethernet will likely come sooner. ;)

EDIT: If http://www.microchip.com/DevelopmentToo ... AC320004-3 is compatible I'll just buy one of these (LAN7820A)

Author:  vak [ Sun Dec 28, 2014 5:57 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Yes, the driver will assume LAN7820A as a PHY. Probably other generic PHYs should work as well, like RTL8201, as all the driver is pretty generic.

I started with Ethernet driver, as it seems much simpler. All the Wi-Fi layer looks quite complicated. I expect to have Ethernet working somewhere in a month.

Author:  wiz [ Sun Dec 28, 2014 3:02 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Hi Serge and all,

Most impressive :) !!!

Wiz

Author:  gewtnet [ Sat Jan 03, 2015 8:30 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

vak wrote:
Yes, the driver will assume LAN7820A as a PHY. Probably other generic PHYs should work as well, like RTL8201, as all the driver is pretty generic.


Just ordered one of those, eagerly await the ability to test.

Quote:
I started with Ethernet driver, as it seems much simpler. All the Wi-Fi layer looks quite complicated. I expect to have Ethernet working somewhere in a month.


Yeah...a wireless stack is NOT exactly trivial! Might point a friend towards this...he does embedded for a living and has RF skills.

Author:  gewtnet [ Tue Jan 06, 2015 10:04 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Okay...seems I ordered the wrong module.

This one...is smaller than I realised...the entire module is about the size of the wifi shield on the Wi-Fire.

Author:  rayg [ Fri Jan 09, 2015 4:14 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

vak wrote:
Yes, the driver will assume LAN7820A as a PHY. Probably other generic PHYs should work as well, like RTL8201, as all the driver is pretty generic.

I started with Ethernet driver, as it seems much simpler. All the Wi-Fi layer looks quite complicated. I expect to have Ethernet working somewhere in a month.


That's the dyslexic version of the LAN8720A ? :) My other question that you have already answered ( I think ) is what RTC would be preferred. PCF8563?

Still thinking about what features are essential on a MZ board.

Ray

Author:  Pito [ Sat Jan 10, 2015 8:57 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

The PCF8563 has the lowest backup current consumption - 200nA, but requires 2 diodes for the backup and an external resonator with tuning cap. You do tune it with the cap or cap trimmer.
The DS3231 and friends need much more backup current (800-1500nA), but include resonator and backup switching, so you do not need any external stuff. They are quite precise and with more features.

Author:  majenko [ Sat Jan 10, 2015 4:35 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

OK... so I have my prototype boards for my SDZL now. I have just built one up, but I am failing completely to boot.

It took me some time to try and even get a bootloader on there - there seems to be a problem using pic32prog with a pickit2 on a PIC32MZ2048ECG064. Once I switched to my PK3 the bootloader installed and worked perfectly.

So I made a config for it, and after a few corrections got it to give me the console. But it can't find the SD card, and I can't work out why.
Code:
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 5 compiled 2015-01-10
    matt@dell:LiteBSD/sys/compile/SDZL.pic32
cpu: PIC32MZ2048ECG064 rev A5, 200 MHz
oscillator: system PLL div 1:6 mult x50
cache: 16/4 kbytes
real mem = 512 kbytes
avail mem = 348 kbytes
using 18 buffers containing 73728 bytes of memory
spi1 at pins sdi=D14/sdo=C1/sck=D1
spi2 at pins sdi=G7/sdo=G8/sck=G6
spi3 at pins sdi=B10/sdo=C4/sck=B14
spi4 at pins sdi=F5/sdo=G0/sck=D10
uart1 at pins rx=D2/tx=D3, interrupts 112/113/114
uart2 at pins rx=B7/tx=B6, interrupts 145/146/147, console
sd0 at port spi2, pin cs=G9
sd0: no SD card detected
sd0: no SD card detected
bpf: lo0 attached
sd0: no SD card detected
ufs_mountroot failed: 19
panic: cannot mount root
syncing disks... done
sd0: no SD card detected

dumping to dev 2, offset 8
dump device bad

The config for the SD is:
Code:
controller      spi2    flags 0x7778    # pins sdi=RG7,  sdo=RG8  - SD card
disk            sd0     at spi2 drive 0 flags 0x79      # select pin RG9  - logical 27
options         "SD_LED=0x57"                           # LED4 is RE7
options         "SD_KHZ=10000"                          # 10MHz clock

As you can see I have tried slowing it down to 10MHz to try and get it to work. I just don't get it.

I'm seeing the SCK, SDO and SS coming out of the chip fine. I'm even seeing the SDI coming back from the SD card. But it's just not detecting the card at all. The whole layout of that portion of the board hasn't changed since the SDXL board it's based on. The same RG6/7/8/9 pins going to the same places in the same way.

Any clues...?

I guess my next step will be to shove loads of debugging into the SPI comms to see what's going on...

Author:  majenko [ Sat Jan 10, 2015 6:00 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Ok, problem solved.

We need to clear ANSELx.y for the SDI pin or it doesn't work. It seems ANSEL overrides everything, not just GPIO.

I have added that functionality to the SPI device and the SD works better, but I'm still not booting:

Code:
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 8 compiled 2015-01-10
    matt@dell:LiteBSD/sys/compile/SDZL.pic32
cpu: PIC32MZ2048ECG064 rev A5, 200 MHz
oscillator: system PLL div 1:6 mult x50
cache: 16/4 kbytes
real mem = 512 kbytes
avail mem = 348 kbytes
using 18 buffers containing 73728 bytes of memory
spi1 at pins sdi=D14/sdo=C1/sck=D1
spi2 at pins sdi=G7/sdo=G8/sck=G6
spi3 at pins sdi=B10/sdo=C4/sck=B14
spi4 at pins sdi=F5/sdo=G0/sck=D10
uart1 at pins rx=D2/tx=D3, interrupts 112/113/114
uart2 at pins rx=B7/tx=B6, interrupts 145/146/147, console
sd0 at port spi2, pin cs=G9
sd0: type II, size 1934336 kbytes, speed 10 Mbit/sec
sd0a: partition type b7, sector 2, size 204800 kbytes
sd0b: partition type b8, sector 409602, size 32768 kbytes
sd0c: partition type b7, sector 475138, size 102400 kbytes
bpf: lo0 attached
WARNING: preposterous clock chip time -- CHECK AND RESET THE DATE!
panic: setrunqueue
syncing disks... done

dumping to dev 2, offset 64512
dump device bad


... investigations continue ...

Serge & Pito - send me your postal addresses and I'll send you one to play with (I have 2 spare MZ chips at the moment).

Author:  Pito [ Sat Jan 10, 2015 6:46 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

@majenko - pm me your postal addr too, I'll send you the 8MB ramdisk module.. Hopefully your board supports PMP bus :)

Author:  majenko [ Sat Jan 10, 2015 6:57 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

That'd be cool. The pinout is almost the same as the SDXL board (and nearly the same as the Fubarino SD), so the PMP should work well. Maybe even use the EIB in some way...?

Author:  Pito [ Sat Jan 10, 2015 7:06 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

The 8MB ramdisk driver for MX in retrobsd works fine, the only thing you have to do is to change a few PMP parameters there such it match 200MHz clock (provided MZ's PMP works in the same way..) .

Code:
https://github.com/RetroBSD/retrobsd/blob/master/sys/pic32/rd_sramc.c

// for 120MHz clock, 70ns PSRAM, Ramdisk v.1.1.
#define ADR_PULSE 1
#define WR_PULSE 5
#define RD_PULSE 11

So I would try

// for 200MHz clock, 70ns PSRAM, Ramdisk v.1.1.
#define ADR_PULSE 2
#define WR_PULSE 9
#define RD_PULSE 20

Author:  rmiddleton [ Sat Jan 10, 2015 9:30 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Just read through the entire thread, this is looking really cool!

Are there any plans to port 4.4 to a pic32mx? Or keep 2.11 for pic32mx and 4.4 for pic32mz?

Author:  majenko [ Sat Jan 10, 2015 9:38 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

There is absolutely zero chance of 4.4BSD ever working on an MX. Not only does it lack the memory, but it also lacks the MMU that 4.4BSD needs. We'll never be able to progress beyond 2.11BSD on the MX.

Author:  alexfru [ Sun Jan 11, 2015 10:46 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
There is absolutely zero chance of 4.4BSD ever working on an MX. Not only does it lack the memory, but it also lacks the MMU that 4.4BSD needs. We'll never be able to progress beyond 2.11BSD on the MX.


The MX is too good. You need the AVR:
https://www.youtube.com/watch?v=nm0POwEtiqE
:)

Author:  majenko [ Sun Jan 11, 2015 11:28 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

LOL!!!! That's hillarious!!!

A 1.7MB Linux kernel in an AVR chip... !!! :lol:

And I didn't know an AVR had 288 IRQs...!

Could that be a Raspberry Pi Compute Node in the board next to the AVR chip maybe...?

Author:  rmiddleton [ Sun Jan 11, 2015 3:10 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
There is absolutely zero chance of 4.4BSD ever working on an MX. Not only does it lack the memory, but it also lacks the MMU that 4.4BSD needs. We'll never be able to progress beyond 2.11BSD on the MX.


What's different about the MMU on the MZ series vs the MX series? Also, what do you mean in terms of 'memory' - RAM or flash?

Author:  majenko [ Sun Jan 11, 2015 3:12 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

rmiddleton wrote:
majenko wrote:
There is absolutely zero chance of 4.4BSD ever working on an MX. Not only does it lack the memory, but it also lacks the MMU that 4.4BSD needs. We'll never be able to progress beyond 2.11BSD on the MX.


What's different about the MMU on the MZ series vs the MX series? Also, what do you mean in terms of 'memory' - RAM or flash?

The difference? The MZ has one, the MX doesn't. The MX has static memory maps, the MZ has a real MMU.

And both flash and RAM. I guess the kernel could be squashed a little, but as it stands it's about 512K in size, and that's the limit of the MX chips. RAM though is the critical one.

Author:  wiz [ Sun Jan 11, 2015 6:38 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Hi RMiddleton,

The one real feature that makes life much easier is the MMU.

Translated to English is called in DECese VMS (Virtual Memory System).

Basically user code is compiled to run in a VERY large virtual memory and pieces of program and data are swapped in and out by the operating system as needed. The programmer just writes code :) !!

The user writes a program of "any" size and it "just runs". Once running it can be made to run much faster by careful optimization when such efforts make sense.

Hope that helps?

Hopefully the MZ can really do this? Seeing is believing. There are so many places that various bugs and missed features can kill the whole feature!

Consider that RetroBSD for the MX has yet to add even the kernel loadable module feature that at least in my humble opinion is required for real use.

Happy 2015 to all.

Wiz

Page 7 of 10 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/