RetroBSD

2.11BSD operating system for microcontrollers
It is currently Mon Mar 25, 2019 6:44 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: QEMU simulator for PIC32
PostPosted: Wed Jan 21, 2015 7:50 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
A port of QEMU simulator for PIC32 microcontrollers is available. You can find the build instructions and examples at wiki page: https://github.com/sergev/qemu/wiki

Two families are implemented: pic32mx7 and pic32mz. For every family, several different boards are supported. Currently, the complete list of boards is:
Examples of running real applications on QEMU PIC32:
"Hello World" on Max32 board
2.11BSD on Max32 board
4.4BSD on WiFire board

Volunteers are welcome to enhance and extend the simulator with more peripherals and board types. I'm going to add an Ethernet port: need it for testing my new network driver for LiteBSD.


Top
 Profile  
 
PostPosted: Wed Jan 21, 2015 5:18 pm 
Contributor

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

VERY IMPRESSIVE !!!!!!!

Qemu on RetroBSD? Just had to think about it :) :).

Nice,

Wiz


Top
 Profile  
 
PostPosted: Wed Jan 21, 2015 6:42 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
I'd really love to play, but I can't get it to compile :(

I had a bucket load of argument size errors with printf formats (needing uinsigned int, got unsigned long, etc). Fixed those with some casting. Then there's loads of functions needing TCGv_i32 but getting TCGv_i64 - so more casting. Eventually I get it to carry on, then I get stuck at a really confusing one...

Code:
/u2/home/matt/git/qemu/target-mips/op_helper.c: In function ‘dump_changed_cop0’:
/u2/home/matt/git/qemu/target-mips/op_helper.c:2643:5: error: implicit declaration of function ‘helper_mfc0_debug’ [-Werror=implicit-function-declaration]
     dump_changed_cop0_reg(env, 23*8 + 0, helper_mfc0_debug(env));
     ^
/u2/home/matt/git/qemu/target-mips/op_helper.c:2643:5: error: nested extern declaration of ‘helper_mfc0_debug’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
/u2/home/matt/git/qemu/rules.mak:57: recipe for target 'target-mips/op_helper.o' failed
make[1]: *** [target-mips/op_helper.o] Error 1
Makefile:169: recipe for target 'subdir-mips-linux-user' failed
make: *** [subdir-mips-linux-user] Error 2

And that's just plain lying. That is, it's lying if CONFIG_USER_ONLY is not defined.

So I don't know what's going on at this point. It may be the configure flags I'm using (just --prefix=/opt/qemu). Any chance you can provide the configure flags that you use to compile with?

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Jan 21, 2015 7:24 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
This works for me on Ubuntu and Mac OS X:
Code:
./configure --prefix=/usr/local/qemu-mips --target-list=mipsel-softmmu

If you don't specify a target list, it tries to build all available targets, and possibly breaks on some of them.


Top
 Profile  
 
PostPosted: Wed Jan 21, 2015 10:57 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Thanks. I guessed that was probably what it was. Compiling now... see if it works in a bit...

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Jan 21, 2015 11:04 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
I just fixed all the build errors for mips64 and user-linux targets. See the last commit: https://github.com/sergev/qemu/commit/1 ... 842eb808fa


Top
 Profile  
 
PostPosted: Thu Jan 22, 2015 12:00 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Brilliant. I guess I can now use it to replace my default QEmu installation instead of having a second (in fact a third, after spindle).

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Jul 25, 2015 4:29 pm 

Joined: Sat Jul 25, 2015 4:08 pm
Posts: 2
hello, I am try to reproduce the results on https://github.com/sergev/qemu/wiki/RetroBSD-Example and things look identical until I get the following.

$ ./retro-bsdq.sh
Code:
Board: chipKIT Max32
Processor: M4K
RAM size: 128 kbytes
Load file: 'boot-max32.hex', 6720 bytes
Load file: 'unix.hex', 143216 bytes
Card0 image 'retrobsd.img', 206849 kbytes

2.11 BSD Unix for PIC32, revision G190 build 1:
     Compiled 2015-01-20 by sergev@ubuntu-sergev:
     /local/BSD/retrobsd-github/sys/pic32/max32
cpu: 795F512L 80 MHz, bus 80 MHz
oscillator: HS crystal, PLL div 1:2 mult x20
console: tty0 (5,0)
sd0: port SPI4, select pin D3
sd1: port SPI4, select pin D4
sd0: no SD/MMC card detected
sd1: no SD/MMC card detected
sd0: no SD/MMC card detected
sd1: no SD/MMC card detected
No root filesystem available!
Please enter device to boot from (press ? to list):

I am using lubuntu

$ uname -a
Linux vmb 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:44 UTC 2014 i686 i686 i686 GNU/Linux

and the script is
$ cat retro-bsdq.sh
Code:
#!/bin/bash
/usr/local/qemu-mips/bin/qemu-system-mipsel \
    -machine pic32mx7-max32                 \
    -nographic                              \
    -monitor          none                  \
    -serial           stdio                 \
    -bios             boot-max32.hex        \
    -kernel           unix.hex              \
    -sd               retrobsd.img

Any thoughts?


Top
 Profile  
 
PostPosted: Sun Aug 02, 2015 1:08 pm 

Joined: Sun Aug 02, 2015 12:58 pm
Posts: 2
fundamental: I've got the same results both on 14.04 (x64) and 15.04(x64) running on VirtualBox, however the other sample, 4.4bsd for pic32mz works perfectly.

I've tried on 15.04(x86) too, same result.... :(


Top
 Profile  
 
PostPosted: Tue Aug 04, 2015 8:47 pm 

Joined: Sat Jul 25, 2015 4:08 pm
Posts: 2
Thanks enemy.

Any thoughts Serge?


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 7:45 pm 

Joined: Sun Aug 02, 2015 12:58 pm
Posts: 2
fundamental: I had re-compiled RetroBSD on 15.04 (x86) by following instructions at http://retrobsd.org/wiki/doku.php/doc/install then I replaced
Code:
unix.hex
with the compiled one
Code:
..../retrobsd/sys/pic32/max32
It worked perfectly.

By replacing the
Code:
retrobsd.img
file with the generated
Code:
sdcard.img
it also works, but it generates several
Code:
sdcard: pread failed, offset 0x6449800
during the boot-up.....


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 10:10 am 

Joined: Wed Oct 14, 2015 10:03 am
Posts: 2
I'm not sure if it applies to the *NIX builds of Qemu, but I hammered out a Windows binary for this, and can't get the SD card to mount.

It's acting like the file is already opened or something else weird. In pic32_sdcard_init, I changed it to open up a file with an extension tacked on, so that I pass it xyz.img and it opens xyz.img.SD and up it boots!

Image

Not too sure why, but I'd call this 'good enough for now' ... :lol:

Because of spammers, I can't post a direct link to my Qemu build if you want this for Windows, instead use this link, and you'll get a 404 page with instructions on the username and password (and another link) to download the exe. Sorry for that, but it's the best fix I could think of.

Really cool stuff, 4.4BSD in 512kb of ram!

I'm totally ignorant on things MIPS but, is there any reason why something like say, a cisco 7200 MIPS r4600/r4700 couldn't run this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 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