RetroBSD
http://retrobsd.org/

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

Author:  majenko [ Wed Dec 10, 2014 10:16 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

You got it. You need both the MIPS compiler and the native compiler. There are (at least) two special programs that need compiling natively in order to build the system: config, for generating the kernel build files, and ufstool for building (and manipulating) the disk image.

Without those the build can't happen, and they're certainly not "normal" Linux applications, in that they aren't in any repositories anywhere (config is from BSD, and ufstool is written by our very own Serge), so they have to be compiled specially at build time.

A few tips on building that I have found:

To rebuild the whole filesystem you need to delete your ${DESTDIR} folder in its entirity - it's no good just doing a "bmake clean".

To update a program in the ${DESTDIR} after modifying it, you need to do a "bmake install" in that program's folder, or the parent folder (say "usr.bin") to place it in ${DESTDIR} - doing "bmake fs" won't do that as ${DESTDIR} already exists.

Compiling a single-file program generally just needs a two-line Makefile:
Code:
PROG=foo
.include <bsd.prog.mk>

That will compile foo.c into foo, and provide install, clean, etc. If the program has more than foo.c then you need one extra line:
Code:
PROG=foo
SRCS=foo.c bar.c
.include <bsd.prog.mk>


Compilation flags can be set with COPTS:
Code:
PROG=foo
SRCS=foo.c bar.c
COPTS=-DDEBUG -DTHIS_SETTING=43
.include <bsd.prog.mk>


There's a helluva lot more you can add to one of those Makefiles to do more things, but that's the two basic ones.

Happy tinkering.

Author:  gewtnet [ Wed Dec 10, 2014 4:18 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
You got it. You need both the MIPS compiler and the native compiler. There are (at least) two special programs that need compiling natively in order to build the system: config, for generating the kernel build files, and ufstool for building (and manipulating) the disk image.

Without those the build can't happen, and they're certainly not "normal" Linux applications, in that they aren't in any repositories anywhere (config is from BSD, and ufstool is written by our very own Serge), so they have to be compiled specially at build time.


I eagerly await 4.4 being able to recompile itself on the PIC...in a week, with immense swapping. ;)

Quote:
A few tips on building that I have found:

To rebuild the whole filesystem you need to delete your ${DESTDIR} folder in its entirity - it's no good just doing a "bmake clean".

To update a program in the ${DESTDIR} after modifying it, you need to do a "bmake install" in that program's folder, or the parent folder (say "usr.bin") to place it in ${DESTDIR} - doing "bmake fs" won't do that as ${DESTDIR} already exists.

Compiling a single-file program generally just needs a two-line Makefile:
Code:
PROG=foo
.include <bsd.prog.mk>

That will compile foo.c into foo, and provide install, clean, etc. If the program has more than foo.c then you need one extra line:
Code:
PROG=foo
SRCS=foo.c bar.c
.include <bsd.prog.mk>


Compilation flags can be set with COPTS:
Code:
PROG=foo
SRCS=foo.c bar.c
COPTS=-DDEBUG -DTHIS_SETTING=43
.include <bsd.prog.mk>


There's a helluva lot more you can add to one of those Makefiles to do more things, but that's the two basic ones.

Happy tinkering.


Thank you! Were there any specific patches made to a bunch of the source files you've found? I tried to "port" some bits from the 4.4 and CSRG SCCS trees I have laying around, and they hit a bunch of undefined symbols.

SEEMINGLY string and maths-related I believe?

Author:  majenko [ Wed Dec 10, 2014 4:25 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Not that I know of.

The main thing to watch is that by default -Wall is defined, so the slightest hiccup will make it b0rk. That means all assignments used as truth values need () around them, all unused variables need removing, all functions need proper prototypes, so the right headers including, etc. Just generally tidying up.

Author:  gewtnet [ Wed Dec 10, 2014 5:16 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
Not that I know of.

The main thing to watch is that by default -Wall is defined, so the slightest hiccup will make it b0rk. That means all assignments used as truth values need () around them, all unused variables need removing, all functions need proper prototypes, so the right headers including, etc. Just generally tidying up.


That certainly provides easier pointers to code that DOES need cleaned up. ;)

Author:  Pito [ Thu Dec 11, 2014 8:25 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Quote:
I eagerly await 4.4 being able to recompile itself on the PIC...in a week, with immense swapping. ;)


In 2015, when still alive, I plan to connect "something MZ" with the 8MB ramdisk. As the MZ still does not provide an SDIO interface (and therefore still running the sdcard at ~20MHz SPI :( :( ), the ramdisk can speed up the system significantly.. (6x with swap on the ramdisk with retrobsd when running several jobs, maybe more with a filesystem on it).

viewtopic.php?f=5&t=35870

Author:  majenko [ Thu Dec 11, 2014 10:43 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

I'm working on porting the spi sram driver from retro at the moment to use my 16 chip SPI SRAM board. Not sure how best to specify the 16 CS pins in the configuration yet though.

Author:  Pito [ Thu Dec 11, 2014 1:17 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

There is still the issue with max SPI speed. Simply it is a bottleneck you cannot avoid with serial sram/fram/mram.
What about a 74154 or friends to make your /CS stuff easier.. :)

Author:  majenko [ Thu Dec 11, 2014 1:41 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Possible, but my board is already built and populated. I'd need to make an adapter board for it. I thought about that after I'd designed and sent it off for fabricating.

Maybe I'll just design a new one with the '154 built in and transfer all the SRAM chips over.

Even with the SPI bottleneck it'll still be faster that SD, and as vi is 502399 bytes in size, every keypress causes swapping while it grabs different chunks of the code...

Author:  Pito [ Thu Dec 11, 2014 2:00 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

An sdcard may have up to 250msecs writing latency, usually around 1-50ms anytime, so it could be faster with a serial sram.. :)
PS> see below writing latency measured with NilRtos logging data to an standard microsdhc card, y=latency peaks in usecs and x=time in msecs.
When measured during longer time period I got 130msec peaks.. You cannot predict the wr latencies, as it is related to the internal housekeeping (wear leveling mostly). It is "random"..

Attachments:
wrlatency.jpg
wrlatency.jpg [ 36.67 KiB | Viewed 17987 times ]

Author:  gewtnet [ Thu Dec 11, 2014 4:32 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Pito wrote:
Quote:
I eagerly await 4.4 being able to recompile itself on the PIC...in a week, with immense swapping. ;)


In 2015, when still alive, I plan to connect "something MZ" with the 8MB ramdisk. As the MZ still does not provide an SDIO interface (and therefore still running the sdcard at ~20MHz SPI :( :( ), the ramdisk can speed up the system significantly.. (6x with swap on the ramdisk with retrobsd when running several jobs, maybe more with a filesystem on it).

viewtopic.php?f=5&t=35870


I'd love to get one of those RAMdisks...but it seems they are no longer for sale? *sigh* SMT work is a pain with bad eyesight. :(

Author:  gewtnet [ Thu Dec 11, 2014 4:34 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
Possible, but my board is already built and populated. I'd need to make an adapter board for it. I thought about that after I'd designed and sent it off for fabricating.

Maybe I'll just design a new one with the '154 built in and transfer all the SRAM chips over.

Even with the SPI bottleneck it'll still be faster that SD, and as vi is 502399 bytes in size, every keypress causes swapping while it grabs different chunks of the code...


I was rather fond of the swapping on every keystroke due to the blinkenlights. ;)

Author:  majenko [ Thu Dec 11, 2014 4:51 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

It is a nice effect, shame it just makes typing so painful. Like a 10 baud modem :)

Also I worry what it's doing to my SD card.

Author:  Pito [ Thu Dec 11, 2014 5:10 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Quote:
I'd love to get one of those RAMdisks...but it seems they are no longer for sale? *sigh* SMT work is a pain with bad eyesight. :(

The ramdisk is using 48BGA package, 0.75mm pitch. Not easy to solder even with perfect eyesight :)

@majenko: the another option would be the SQI. May be you may invest a long winter evening with SQI driver for an SQI memory your preferred supplier sends to you as the Xmas gift :).
May be there is somebody producing SQI srams with large capacities, or, you may wipe the dust off your altera dev sys and you may try to connect a ddram via SQI to pic32MZ.
But first I would try to measure the speed with a small SQI sram, not to waste too much time with altera when too slow.

Author:  wiz [ Thu Dec 11, 2014 5:23 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Hi Pito and all,

I wonder if the board could be hooked up somehow to a "big system" that acted like a fast swap memory? Hooking up lots of pins seems like the wrong path?

Pito, you latency plot is VERY informative :).

Happy Holidays to all.

Wiz

Author:  Pito [ Thu Dec 11, 2014 5:38 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Quote:
I wonder if the board could be hooked up somehow to a "big system" that acted like a fast swap memory? Hooking up lots of pins seems like the wrong path?

fat16lib at arduino has connected 500GB HDD via SPI2USB to UNO. It works, so you can connect a big stuff to the wifire sure.. But again, the pic32MZ is quite limited with its simple and slow SPI, I would say it is a big crap, compared to, for example, an stm32F4 and friends. The SDIO is something which is really missing with this device. Having that w/ pic32MZ your sdcard would do 5MB/sec easily.. :?

Another option is the parallel i/o called PMP with pic32, which I use with ramdisk. I think ~30-40MB/sec could be the max PMP speed with MZ in 8bit mode or 60-80MB/sec in 16bit mode. The 8MB ramdisk can do ~10MB/sec block rd/wr max due to its relatively slow SDRAM inside (75ns). It uses 11 signals only..

PS: before the Xmas I will send an 8MB ramdisk module to majenko (pls send me your mail addr), so he may play and write a perfect MZ driver for it. The PMP retrobsd driver (swap and filesystem) does exist, so he may reuse the code. In February there could be a new batch of 8MB ramdisks available at the store.

Author:  majenko [ Fri Dec 12, 2014 12:09 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

All the SPI SRAM chips I use are also SQI. Max still seems to be 128KB though, and as the MZ only supports two SQI chips on its bus that's not going to be much of a help. And anyway, that would (ideally, if it works in the A4) create 256KB of extra system RAM rather than swap space.

Besides, I was going to try and bend the SQI interface into a 16-colour VGA interface...

Author:  majenko [ Fri Dec 12, 2014 1:23 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Heh... I just passed the entire LiteBSD tree's C and H files through Artistic Style with my preferred options. It ended up with a 1.8 million line diff in git !!! :twisted:

Author:  gewtnet [ Fri Dec 12, 2014 1:43 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

majenko wrote:
Heh... I just passed the entire LiteBSD tree's C and H files through Artistic Style with my preferred options. It ended up with a 1.8 million line diff in git !!! :twisted:


Tiny.

Author:  Pito [ Fri Dec 12, 2014 9:23 am ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

Quote:
And anyway, that would (ideally, if it works in the A4) create 256KB of extra system RAM rather than swap space.

Hmm, the overhead with random access to a word is huge with SPI or SQI srams. Maybe 60%..
4MB/sec max random rd/wr access to a word with SQI, I would guess.. 50x slower than rd/wr into the internal ram.
SQI would be great for swap, when larger capacities will be available (ie 1kB block access)

Author:  majenko [ Sat Dec 27, 2014 11:04 pm ]
Post subject:  Re: 4.4bsd booted in multi-user mode on pic32mz

I've just ordered a prototype board of my PIC32MZ Fubarino-like board. MCHP also have the chips available for sample, so they're on order too.

There's still no USB bootloader support (we're trying to wangle changing the license of some of the Harmony code to BSD so we can use that), so programming will have to be either through a pickit or a UART bootloader and an external FT232 board.

It's highly experimental at this stage (my first MZ board), so I don't know if it'll even power up or not yet.

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