NuttX on a BluePill

Anything not related to STM32
acassis
Posts: 22
Joined: Mon Sep 18, 2017 3:27 pm

Re: NuttX on a BluePill

Post by acassis » Tue Sep 19, 2017 10:36 pm

Pito wrote:
Tue Sep 19, 2017 9:47 pm
36MHz SPI set:

Code: Select all

nsh> dd if=/mnt/STM32Demo.bin of=/mnt/BBBBB
8388608 bytes copied, 0 msec, 152 KB/s
nsh>
This took 42secs = 199kB/sec

Code: Select all

nsh> cp /mnt/STM32Demo.bin /mnt/CCCC.bin
 -rw-rw-rw- 8388608 CCCC.bin
nsh>

Code: Select all

nsh> dd if=/mnt/CCCC.bin of=/dev/null
8388608 bytes copied, 0 msec, 477 KB/s
nsh>

Code: Select all

nsh> dd bs=4096 if=/mnt/CCCC.bin of=/mnt/GGGG.bin
8388608 bytes copied, 0 msec, 287 KB/s

Code: Select all

nsh> dd bs=8192 if=/mnt/CCCC.bin of=/mnt/DDDD.bin
8388608 bytes copied, 0 msec, 299 KB/s

Code: Select all

nsh> dd bs=16384 if=/mnt/CCCC.bin of=/mnt/FFFF.bin
8388608 bytes copied, 0 msec, 305 KB/s

Code: Select all

nsh> dd bs=32768 if=/mnt/CCCC.bin of=/mnt/EEEE.bin
8388608 bytes copied, 0 msec, 308 KB/s
Strange, I suspect that the physic SPI clock is wrong or there is something in the system holding the performance. I used MMC over SPI but didn't test its performance. Actually it should be a nice test to do!

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: NuttX on a BluePill

Post by Pito » Tue Sep 19, 2017 11:13 pm

Yeah, the filesystem performance over SPI (EDIT: NONE DMA) here is not the best. Needs finetuning, sure. I've tried to enable DMA with SPI, but it does not boot (perhaps it needs to be implemented in src). Here is the ramdisk performance - that should be the sdcard's one :)
We may try with SDIO on F407 (SDIO socket there) later on.
Ramdisk size 256kB.

Code: Select all

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>
Last edited by Pito on Wed Sep 20, 2017 1:44 am, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: NuttX on a BluePill

Post by Pito » Tue Sep 19, 2017 11:40 pm

For fun:

Code: Select all

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
00a0: 6c 65 61 73 65 20 69 6e 73 65 72 74 20 61 20 62 lease insert a b
00b0: 6f 6f 74 61 62 6c 65 20 66 6c 6f 70 70 79 20 61 ootable floppy a
00c0: 6e 64 0d 0a 70 72 65 73 73 20 61 6e 79 20 6b 65 nd..press any ke
00d0: 79 20 74 6f 20 74 72 79 20 61 67 61 69 6e 20 2e y to try again .
:)
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: NuttX on a BluePill

Post by Pito » Wed Sep 20, 2017 1:34 am

With SPI1 @36MHz and DMA1 for SPI1 enabled (Sandisk 16GB CL10):

Code: Select all

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>
Much better :)
Pukao Hats Cleaning Services Ltd.

User avatar
zoomx
Posts: 495
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: NuttX on a BluePill

Post by zoomx » Wed Sep 20, 2017 10:40 am

acassis wrote:
Tue Sep 19, 2017 3:39 pm
zoomx the right NuttX repository is this: https://bitbucket.org/nuttx/nuttx
Thanks! I just posted a link of a repository that seems to have an STM32F103 porting but I don't know if it is up to date or even if it works.

acassis
Posts: 22
Joined: Mon Sep 18, 2017 3:27 pm

Re: NuttX on a BluePill

Post by acassis » Wed Sep 20, 2017 11:55 am

Pito wrote:
Wed Sep 20, 2017 1:34 am
With SPI1 @36MHz and DMA1 for SPI1 enabled (Sandisk 16GB CL10):

Code: Select all

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>
Much better :)
Nice! Please try to copy from SDCard to RAMDISK, it should be an interesting test to do! ;-)

acassis
Posts: 22
Joined: Mon Sep 18, 2017 3:27 pm

Re: NuttX on a BluePill

Post by acassis » Wed Sep 20, 2017 11:56 am

zoomx wrote:
Wed Sep 20, 2017 10:40 am
acassis wrote:
Tue Sep 19, 2017 3:39 pm
zoomx the right NuttX repository is this: https://bitbucket.org/nuttx/nuttx
Thanks! I just posted a link of a repository that seems to have an STM32F103 porting but I don't know if it is up to date or even if it works.
Ah OK! There is a mirror at github, but it is other URL and AFAIK is not updated often.

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: NuttX on a BluePill

Post by Pito » Wed Sep 20, 2017 2:17 pm

Nice! Please try to copy from SDCard to RAMDISK, it should be an interesting test to do! ;-)
Here you are - the entire session such the people may try as well fast:
1. a ramdisk sized ~400kB created
2. an sdcard filesystem mounted
3. a TEST.bin file ~300kB created on the sdcard and then copied from/to the ramdisk
All done on STM32F103ZE @72MHz, 512kB 10ns Sram (A=0, D=1), SPI1(36MHz, DMA on), Sandisk 16GB CL10.

Code: Select all

NuttShell (NSH)
No MOTD string provided
nsh> mkrd -m 1 -s 512 800
nsh> mkfatfs /dev/ram1
nsh> mount -t vfat /dev/ram1 /ramdisk
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh>
nsh> df
  Block  Number
  Size   Blocks     Used Available Mounted on
   512      761        2       759 /ramdisk
 32768   485936   169547    316389 /sdcard
nsh> ls -l /dev
/dev:
 crw-rw-rw-       0 console
 brw-rw-rw-       0 mmcsd0
 crw-rw-rw-       0 null
 brw-rw-rw-       0 ram1
 crw-rw-rw-       0 ttyS0
 crw-rw-rw-       0 urandom
 crw-rw-rw-       0 zero
nsh>
nsh> dd if=/dev/zero of=/sdcard/TEST.bin bs=1024 count=300
307200 bytes copied, 630 msec, 487 KB/s
nsh>
nsh> dd if=/sdcard/TEST.bin of=/ramdisk/AAAA.bin
307200 bytes copied, 370 msec, 830 KB/s
nsh>
nsh> dd if=/ramdisk/AAAA.bin of=/sdcard/OOOO.bin
307200 bytes copied, 980 msec, 313 KB/s
nsh>
nsh> time "cp /ramdisk/AAAA.bin /sdcard/WWWW.bin"
0.6800 sec
nsh>
nsh> rm /ramdisk/AAAA.bin
nsh> time "cp /sdcard/WWWW.bin /ramdisk/SSSS.bin"
0.3100 sec
nsh>
nsh> ls -l /ramdisk
/ramdisk:
 -rw-rw-rw-  307200 SSSS.bin
nsh>
Also, we need 1ms tick :) (it is 10ms now).

PSS: is this an "ls" bug? - the sizes a wrong:

Code: Select all

nsh> ls -l
/:
 dr--r--r--       0 dev/
 drw-rw-rw-617410711 ramdisk/
 drw-rw-rw--1314768292 sdcard/
nsh>
The ramdisk content shown ~2000x of the reality (307k), the sdcard's one is also not good, it shall be 1.615GB.
Last edited by Pito on Wed Sep 20, 2017 3:34 pm, edited 3 times in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: NuttX on a BluePill

Post by Pito » Wed Sep 20, 2017 3:09 pm

This is the way I created a shell script "mrdisk" for creating a ramdisk :) without an editor available..
Copy and paste work perfectly in TeraTerm, set NewLine to CR/CR. I've also set 256chars per line via menuconfig.
Fantastic stuff the ">" and ">>" work here!

Code: Select all

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>
What is nice you can copy and paste the entire block - like

Code: Select all

mount -t vfat /dev/mmcsd0 /sdcard
mkrd -m 1 -s 512 800
mkfatfs /dev/ram1
mount -t vfat /dev/ram1 /ramdisk
df

into the terminal (115k2 here), with Linux or Win line endings, and with 0 (zero !!!) char and line transmit delays, and you get

Code: Select all

NuttShell (NSH)
No MOTD string provided
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh> mkrd -m 1 -s 512 800
nsh> mkfatfs /dev/ram1
nsh> mount -t vfat /dev/ram1 /ramdisk
nsh> df
  Block  Number
  Size   Blocks     Used Available Mounted on
   512      761        2       759 /ramdisk
 32768   485936     3178    482758 /sdcard
nsh>
:shock: Great!!
Pukao Hats Cleaning Services Ltd.

acassis
Posts: 22
Joined: Mon Sep 18, 2017 3:27 pm

Re: NuttX on a BluePill

Post by acassis » Wed Sep 20, 2017 6:32 pm

Pito wrote:
Wed Sep 20, 2017 3:09 pm
This is the way I created a shell script "mrdisk" for creating a ramdisk :) without an editor available..
Copy and paste work perfectly in TeraTerm, set NewLine to CR/CR. I've also set 256chars per line via menuconfig.
Fantastic stuff the ">" and ">>" work here!

Code: Select all

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>
What is nice you can copy and paste the entire block - like

Code: Select all

mount -t vfat /dev/mmcsd0 /sdcard
mkrd -m 1 -s 512 800
mkfatfs /dev/ram1
mount -t vfat /dev/ram1 /ramdisk
df

into the terminal (115k2 here), with Linux or Win line endings, and with 0 (zero !!!) char and line transmit delays, and you get

Code: Select all

NuttShell (NSH)
No MOTD string provided
nsh> mount -t vfat /dev/mmcsd0 /sdcard
nsh> mkrd -m 1 -s 512 800
nsh> mkfatfs /dev/ram1
nsh> mount -t vfat /dev/ram1 /ramdisk
nsh> df
  Block  Number
  Size   Blocks     Used Available Mounted on
   512      761        2       759 /ramdisk
 32768   485936     3178    482758 /sdcard
nsh>
:shock: Great!!
Hi Pito, very nice these tests! You discovered many interesting things! I will report about this "ls -l" issue, it should list the mounted directory as 0 instead showing wrong size report.

Post Reply