RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Dec 14, 2017 4:47 pm

All times are UTC




Post new topic Reply to topic  [ 16 posts ] 
Author Message
 Post subject: DIP Barebones options?
PostPosted: Wed Oct 11, 2017 6:32 pm 

Joined: Wed Oct 11, 2017 6:28 pm
Posts: 1
Hi all,

I have two questions, both of which may seem a little stupid but I'm going to ask them anyway ;)

I've set up RetroBSD on a Fubarino-SD. I was wondering if there was any bare bones PIC32 chip in a PDIP package that it could be shoehorned into.

The reason I ask is that I've developed a small ATTiny-based board to teach people soldering, and am looking at ideas for what to build next. A DIP-based Unix system would be something I think would definitely excite people looking to go beyond the basics, even if it's utility was fairly constrained.

The other question I have is whether or not it's feasible to trim things to below 128k of RAM. I doubt so, but thought I'd ask.

Cheers,
Steve


Top
 Profile  
 
PostPosted: Thu Oct 12, 2017 10:05 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
64KiB is the most RAM you can get in a DIP PIC32 (MX170 / MX270), so as it stands, no you can't put RetroBSD on any of the DIP ones.

Can it be pruned to below 128KiB? Unlikely. You could get it to boot, sure, but you wouldn't be able to run any programs. Memory is already tight, and halving it would be completely crippling.

For the smaller chips you're better off looking at something like FreeRTOS

_________________
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: Fri Oct 13, 2017 8:34 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2400
Location: Rapa Nui
Or NuttX:
http://nuttx.org/

Works fine with 64kB Ram (and w/ 20kB too). Sdcard with fat32, posix shell, zmodem, etc fit in about 90kB flash. Offers a configuration tool for easy-building the system.
It supports the loading of ELF binaries, loading of the kernel modules (like Linux kernel), and loading of dynamic libraries (all this is for experienced users, I have not tested that yet).
Cool stuff, sure..

NuttShell
http://nuttx.org/doku.php?id=documentation:nuttshell

I've been playing with it on an stm32, but PIC32MX/MZ is supported as well, they say..

Examples from my experiments:
Code:
nsh> echo "mkrd -m 1 -s 512 800" >> /sdcard/mrdisk
nsh> echo "mkfatfs /dev/ram1" >> /sdcard/mrdisk
nsh> echo "mount -t vfat /dev/ram1 /ramdisk" >> /sdcard/mrdisk
nsh> cat /sdcard/mrdisk
mkrd -m 1 -s 512 800
mkfatfs /dev/ram1
mount -t vfat /dev/ram1 /ramdisk
nsh>
nsh> sh /sdcard/mrdisk
nsh>
nsh> df
  Block  Number
  Size   Blocks     Used Available Mounted on
   512      761        2       759 /ramdisk
 32768   485936     3179    482757 /sdcard
nsh>

Code:
nsh> dd if=/mnt/STM32Demo.bin of=/mnt/ZZZZZ
8388608 bytes copied, 37730 msec, 222 KB/s
nsh>
nsh> dd bs=1024 if=/mnt/CCCC.bin of=/mnt/QQQQ.bin
8388608 bytes copied, 25740 msec, 325 KB/s
nsh>
nsh> dd bs=2048 if=/mnt/CCCC.bin of=/mnt/SSSS.bin
8388608 bytes copied, 16930 msec, 495 KB/s
nsh>
nsh> dd bs=4096 if=/mnt/CCCC.bin of=/mnt/GGGG.bin
8388608 bytes copied, 12630 msec, 664 KB/s
nsh>
nsh> dd bs=8192 if=/mnt/CCCC.bin of=/mnt/DDDD.bin
8388608 bytes copied, 10730 msec, 781 KB/s
nsh>
nsh> dd bs=16384 if=/mnt/CCCC.bin of=/mnt/FFFF.bin
8388608 bytes copied, 10340 msec, 811 KB/s
nsh>
nsh> dd bs=32768 if=/mnt/CCCC.bin of=/mnt/EEEE.bin
8388608 bytes copied, 10230 msec, 820 KB/s
nsh>
nsh> dd if=/mnt/CCCC.bin of=/dev/null
8388608 bytes copied, 9990 msec, 839 KB/s
nsh>

Code:
nsh> dd if=/dev/zero of=/rdisk/RRRRR.dat bs=1024 count=128
131072 bytes copied, 40 msec, 3276 KB/s
nsh> df
  Block  Number
  Size   Blocks     Used Available Mounted on
 32768   485936   168522    317414 /mnt
     0        0        0         0 /proc
   512      475      258       217 /rdisk
nsh>

Code:
nsh> xd 20000000 65536 > /mnt/iram_dump.txt
nsh> ls -l /mnt
/mnt:
 -rw-rw-rw-  290826 iram_dump.txt
..
nsh> cat /mnt/iram_dump.txt
Hex dump:
..
0080: fe 54 68 69 73 20 69 73 20 6e 6f 74 20 61 20 62 .This is not a b
0090: 6f 6f 74 61 62 6c 65 20 64 69 73 6b 2e 20 20 50 ootable disk.  P
..

@majenko: I highly recommend to your very attention - really a great gadget..
Offers tremendous amount of features..

PS: I've been running it on an stm32F103ZET (64kB ram, 512kB flash) with a 512kB external sram wired via FSMC. Sdcard w/ fat32 via SPI @36MHz (DMA on). All hw settings supported by the menuconfig tool. The external 512kB sram here is used as Heap (ie with an ramdisk) only (not needed for running the OS itself).

It will definitely run on a DIP PIC32 (MX170 / MX270) as it runs on an stm32F103C8 (20kB ram, 128kB flash).
On MZ it could support the MMU, afaik.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Thu Oct 19, 2017 5:59 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi PIto,

Nuttx looks very interesting. Does it support kernel loadable modules?

I didn't see that called out? But who knows maybe it does. It does have an impressive number of features.

IMHO - Having a fixed minimal OS augmented with loadable modules makes growing the system a little at a time MUCH easier. Especially when getting new hardware running.

I have been running Linux on SD with an SD -> USB2 adapter. VERY impressive speed wise and easy to change OS to run say Kicad latest version. I am typing this on Knoppix 7.2.0 running on SD.

Now that I have used this SD for a while, I have noticed several instances when a partition has disappeared which leads to the question....

If I am using nuttx and unplug the SD and reinsert it or insert a different nuttx version, will nuttx automatically dust itself off and resume running? Reseting itself to the extent needed. And can I have 2 SDs installed and do an 'image' transfer so I have cloned a copy of the known good OS to another SD for a 'real' known good backup?

And Pito, what is Serge's website again please? I hope he and you are doing OK in these trying times.

Glad to see some activity on this site again.

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Fri Oct 20, 2017 7:45 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2400
Location: Rapa Nui
Wiz, I do not have the sdcard detection signal available on my socket, so the hotswap will therefore most probably not work. The mount/umount works however:
Code:
NuttShell (NSH)
No MOTD string provided
nsh> help
help usage:  help [-v] [<cmd>]

  [           date        free        mkrd        rmdir       unset
  ?           dd          help        mh          set         usleep
  break       df          hexdump     mount       sh          xd
  cat         echo        kill        mv          sleep
  cd          printf      ls          mw          test
  cp          exec        mb          ps          time
  cmp         exit        mkdir       pwd         true
  dirname     false       mkfatfs     rm          umount

Builtin Apps:
  rz
  sz
nsh> free
             total       used       free    largest
Mem:        583600      10704     572896     524272
nsh>
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh> ls -l /sdcard
/sdcard:
 -rw-rw-rw-  480054 Mandel.bmp
 -rw-rw-rw- 8388608 STM32Demo.bin
..
nsh> umount /sdcard
nsh> ls -l /sdcard
nsh: ls: stat failed: 2
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh> ls -l /sdcard
/sdcard:
 -rw-rw-rw-  480054 Mandel.bmp
 -rw-rw-rw- 8388608 STM32Demo.bin
 -rw-rw-rw- 8388608 XXXX.bin
..
nsh> umount /sdcard
nsh> ls -l /sdcard
nsh: ls: stat failed: 2                 
nsh>                                   <<<<<<<<<<<<< SDCARD HOTSWAPPED
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh: mount: mount failed: 19
nsh> ls -l /dev
/dev:
 crw-rw-rw-       0 console
 brw-rw-rw-       0 mmcsd0
 crw-rw-rw-       0 null
 crw-rw-rw-       0 ttyS0
 crw-rw-rw-       0 urandom
 crw-rw-rw-       0 zero
nsh>

Error 19 means "No such device".

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Oct 20, 2017 8:47 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Pito,

Thanks. Guess I gotta give nuttx a real look. To properly reinit SD you must remove all voltages. So you need a VCC switch, etc. Probably one for each SD socket.

Is nuttx all open source? First look says so.

Given the huge SDs now available, some sort of easy to hack interpreted language with easy link to C or Fortran routines for speed looks pretty interesting.

I guess Python has become the hacking language of choice, but I expect the libraries get pretty huge and swapping or some such technique to extend RAM remains the real problem.

Glad you are still hacking. I think I am finally going to get another product started. I have been playing with 40M hfsigs.com box. Pretty impressive. I wonder what we could do with a PIC attached. FT8 with some added bells and whistles could do an HF 'cell fone'. No internet needed! No analog voice at all, all digital :).

And the whole thing could be frequency agile!! Just find a path.

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Fri Oct 20, 2017 9:28 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
Quote:
Given the huge SDs now available, some sort of easy to hack interpreted language with easy link to C or Fortran routines for speed looks pretty interesting.

I have been playing with Javascript (mujs) on MZ chips recently... Hoping to build a whole system around it. It's promising, and easy to extend with calls to C++ functions - and all under the Arduino API for simplicity of programming...

_________________
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: Fri Oct 20, 2017 8:30 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Matt,

How big is mujs? Will it run on MX? Could you put your stuff up somewhere?

Lots of fun :).

warm regards,
Wiz


Top
 Profile  
 
PostPosted: Sat Oct 21, 2017 8:32 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
I think it may work on MX, yes. The biggest issue is memory. The chipKIT compiler's libc is crippled in that it sets a hard limit on the heap size. I have argued many times with them, and even provided my own version of libc, but they seem very reluctant to release the heap. So you may need to tweak a linker script to get the heap bigger for the memory to hold the script.

I have it online somewhere - been a while since I looked at it. One mo....

Ah, here it is: https://github.com/MajenkoLibraries/MuJS

My god, is it really that long since I last played with it?!?! Crikey!

_________________
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: Sun Oct 22, 2017 6:07 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Matt,

Most PICs have large portions of executable flash. Generally they are mostly empty at least with my stuff. Serge suggested maybe some libc stuff could be there. I was thinking about retroforth. But your comments and a quick look at mujs make me wonder if 'most' of it could reside there? Thus conserving a LOT of ram for other uses?

I especially like the observation that 'most' javascript will just run. I have yet to really embrace javascript, but your version of mujs seems like it could just work. The actual javascript could be in SD and huge with 'most' of the interpreter in executable flash?

I have not written any make files, but given one mujs would seem to compile for X86 as well as PIC. And the .js programs would be easily hackable directly on the PIC via serial port of whatever?

The whole question of mutil-threads and co-routines would be interesting to look at.

Also, I wonder if a PIC box could be a smart javascript filter in this world of MUCH too bloated and smart 'broswers'.... Pig browsers with LOTS of unwanted crap included.

warm regards,

Wiz


Top
 Profile  
 
PostPosted: Sun Oct 22, 2017 7:04 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
Flash can't help with JS. Yes, the more functions you provide in C the smaller your JS program can be, but you risk ending up writing your program in C and exposing it as a couple of JS functions. Pretty pointless.

The JS has to be loaded into RAM and interpreted before running it. That can only be done in RAM. The PIC32 has plenty of RAM for it - except it uses the heap, and the chipKIT compiler only allocates a specified amount of memory (set in the linker script) to the heap. It's retarded.

_________________
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: Tue Oct 24, 2017 8:59 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Matt,

Thanks. I probably don't understand program flow?

1. I write javascript stored as a text file. - can be in SD

2. First stage of mujs converts my javascript to some intermediate language - [java?]

3. mujs interprets this internal language using the init - loop paradigm of Arduino

If this is correct, it would seem that the part of mujs that does step 2 above could be in executable flash? While actual running code would make more sense to be in real RAM at least until it is known good code and then just the variables would need to be in RAM?

I would assume that the javascript converter is the biggest part of the code?

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 9:18 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
I'm not sure it's possible to get at part 2. You "load" the program (js.load(const char *)) which then interprets it into whatever it wants internally (no idea what that is - some form of bytecode if it has any sense) which is then executed by the MuJS VM (by calling an exposed function which can only be exposed by the library not your code). I chose to implement setup() and loop() as exposed functions so it fits with the Arduino paradigm.

If you could get the bytecode out and feed it back in again at will, then sure, you could store it in flash. However, where would really be the point of that? You may as well program in C as Javascript if all you are wanting is the "compiled" code to run on the target chip. The whole point of writing in Javascript is that you are programming Javascript directly on the target chip - maybe from an SD card, maybe through a web interface, etc.

_________________
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: Tue Oct 24, 2017 8:04 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Matt,

Thanks. That is what I was guessing.

I really like your comment that the javascript can be run anywhere. So it really is a portable language. That certianly is THE BIG DEAL.

I am still wondering what can really be done that is useful with executable flash?

I suppose this is the same question as to what could be put into the EPROM sockets of the very early IBM PCs. For most purposes they were never used with an occasional OEM being the exception.

Now boot memory is flash that is easy to hack in what is basically an undetectable way!!

That together with the 'unused' portion of SD that fdisk leaves at the beginning have gotten me to wondering what is really going on in my PCs. Particularly the Acer that stopped booting reliably. Is that really a hardware problem? I very much doubit it. But it got so bad that I switched computers for now.

More abandoned computer junk. This one has some bad keys. So it was USB keyboard time.

Talked earlier today to a friend who was OK with her phone needing to be rebooted each week since it was now a computer!!

Amazing the effect of DOS has had on the need for a reset button :).

Oh well. I still try to build stuff that works!! I bet you do too!

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 5:28 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1091
Hi Matt,

I have been looking at mujs. It looks interesting for the reasons you have mentioned.

This led me to look at typical js downloads for typical websites.

I use seamonkey and when I save the site it creates an .html file with an associated directory full of js, css, png and other files.

So far this looks much too complex to understand to me? Am I missing some easy path? I get typically 3-5 megabytes of 'stuff'.

Which seems at odds with use in any small embedded device?

Does mujs have any hope of 'interpreting' this sort of code? And the related question: Can mujs do anything non-trivial when run on a small device.

Of current interest is some sort of chart recorder function. In js?

warm regards,
Wiz


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 10:10 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
No. The JS you get on a website is completely different. It is all about manipulating the web page - something you certainly don't have on MuJS.

MuJS is closer to the Arduino language, but with javascript syntax. You call the same functions (since that I what functions I created in it) to manipulate things.

It's the same syntax as what you get on a website, but the intent and facilities, and hence what you write in it, is completely different.

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