Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:51 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : (DM) StickOS support for DuinoMite

Author Message
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 07:31pm 10 Feb 2012
Copy link to clipboard 
Print this post

StickOS is another BASIC interpreter but pre-tokenize the source instead of keeping it in text as MM-BASIC.

Here is the list of StickOS BASIC commands.

DuinoMite is now with BETA support and you can download the HEX from HERE

StickOS seems to be x3 times faster than MM-BASIC seen from HERE

I will load StickOS on DuinoMite and will play this weekend then will post my impression from it in this thread.
 
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 08:13pm 12 Feb 2012
Copy link to clipboard 
Print this post

ok, I installed StickOS on DuinoMite-Mega and test it now.

What I do like:

1. pre-tokenize when you enter your line and warn you for syntax errors and show you exactly where the error is, this also speed up the code execution as the interpreter use 1 byte token to switch the command instead to compare multiply bytes for each command

2. use the real UART, SPI, I2C no bitbanging, which allow it to execute the BASIC statements very fast, about x4 times faster than MM/DM

10 dim a
20 configure timer 1 for 1 s
30 on timer 1 do print a
40 for a = 1 to 200000
50 next

executes and prints 112518 BASIC instructions per second vs 28608 in MM3.1

the BM1 test:
10 dim time, i
20 time = ticks
30 for i = 1 to 1000
40 next
50 print ticks-time

when exectuted returns 35 ticks which equals to 0.00875 seconds vs 0,016 s in MM


what I do not like in StickOS:

1. not open source, although you have some skeleton source which allow you to add your own commands and to link to the core stickos code
2. no graphics, no VGA, no keyboard support, just terminal via USB
3. no SD card file system
4. print command is simply implemented
5. while MM complete about everything MS BASIC have, stickOS implements less complete set of commands

for those who are interested HERE is the quickstart guide and HERE is the users manual.

loading the firmware is very simple just start the bootloader and load this HEX file then if you are on windows you will need also this INF file

you can switch back to MM/DM basic by simple re-loading the MM/DM hex.
Edited by Olimex 2012-02-14
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 02:11am 13 Feb 2012
Copy link to clipboard 
Print this post

  Olimex said  What I do like:

1. pre-tokenize when you enter your line and warn you for syntax errors and show you exactly where the error is, this also speed up the code execution as the interpreter use 1 byte token to switch the command instead to compare multiply bytes for each command

Just for the record, MMBasic dies the same thing. Ie, converts your program (when you enter it) to one byte tokens for command, functions and keywords.

To get the speed StickOS must do some extra compiling like converting constants to binary numbers, reducing expressions, etc. MMBasic does not do this because it needs to retain the original human readable program so that you can list and edit it.

Geoff
Geoff Graham - http://geoffg.net
 
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 03:58pm 13 Feb 2012
Copy link to clipboard 
Print this post

Indeed they probably pre-process the expressions

Anyway after worked so much with MM BASIC I wouldn't switch over to less comprehensive BASIC implementation, just because there is some speed advantage
I can add whatever I need in C to DM-BASIC and still stay with the convenient VGA/PS2 stand alone operation and the wide range of commands implemented.

This is just an alternative option for curious people who want to evaluate something new.
 
Juri74

Senior Member

Joined: 06/02/2012
Location: Italy
Posts: 162
Posted: 06:27pm 13 Feb 2012
Copy link to clipboard 
Print this post

maybe stickos is faster because it doesnt spent processor time to manage sd/vga/keyboard..
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 09:20pm 13 Feb 2012
Copy link to clipboard 
Print this post

  Juri74 said   maybe stickos is faster because it doesnt spent processor time to manage sd/vga/keyboard..

That cannot be it. I once ran some tests and (from memory) USB took about 2% of the CPU time and video (VGA or composite) took about 5%. The SD card takes zero unless it is reading/writing.

You can test this with 3.1. When you unplug the USB cable the firmware detects the lack of +5V and completely stops any USB processing. Then, using the CONFIG VIDEO OFF command, you can completely disable the video and test the difference there (reboot first). In both cases it will be negligible.

GeoffEdited by Geoffg 2012-02-15
Geoff Graham - http://geoffg.net
 
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 10:56pm 13 Feb 2012
Copy link to clipboard 
Print this post

is it possible to do some kind of profiling and to see which parts eat most of the time?

my blind guess is the timer interrupts for the GPIO state polling, but it may be something else as well

when I posted on my blog the speed benchmark I got this e-mail from Paul Curtis who wrote SolderCore basic

Saw this:

http://olimex.wordpress.com/2012/01/12/duinomite-basic-instr uctions-per-seco
nd-speed-bips/

Speed approx.: 31044 BIPS

...so, tried this:

C:\User\Paul>telnet soldercore
_____ __ __ ______
/ ___/____ / /___/ /__ _____/ ____/___ ________
\__ \/ __ \/ / __ / _ \/ ___/ / / __ \/ ___/ _ \
___/ / /_/ / / /_/ / __/ / / /___/ /_/ / / / __/
/____/\____/_/\__,_/\___/_/ \____/\____/_/ \___/

Welcome to CoreBASIC on the SolderCore.
Copyright (c) 2004-2012 Rowley Associates Limited.

65,528 bytes free. Core at 80 MHz.

>10 T = TICK
>20 I = I + 1
>30 IF TICK - T < 80000000 THEN GOTO 20
>40 PRINT I * 3; " BIPS"
>run
175065 BIPS
>

You should be able to do better. ;-)


SolderCore have no VGA nor keyboard as well, but run on 32 processor @80Mhz as MM-BASIC
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 11:31pm 13 Feb 2012
Copy link to clipboard 
Print this post

Yes, that is how I got a lot of the speed improvement in 2.6 and 2.7.

From 2.7 onwards you can uncomment the following line in Maximite.h
//#define PROFILE

Then, when you recompile the source, profiling will be installed.

To use the profiling you should use the RUN command to run your benchmark program. When the program exits MMBasic will write an Excel spreadsheet called PROFILE.XLS to the SD card. This contains a list of addresses and the number of times that the program counter was at that address. If you sort the spreadsheet by the second column (the count) you will see where the program spent most of its time. Then, using the MAP file generated by MPLAB in the compile, you can figure out what functions the program was spending most time on.

Profiling uses up about 10% of the CPU's time and most of the general memory so you do not want it running all the time.

Obviously I used this to speed up the critical parts but then I found that the critical sections depended very much on what sort of benchmark that you were running. Interestingly polling the GPIO's was not the largest part (although it was significant). My next target would be to optimise the variable lookup routines as they often showed up as the greatest consumers of the CPU's time.

Regardless, I don't think that we can go six times faster so CoreBASIC must be sacrificing something to get that speed. I have not looked at it but perhaps it is a compiler, or uses integer maths, or something.

Geoff
Geoff Graham - http://geoffg.net
 
Gadget
Regular Member

Joined: 22/06/2011
Location: Australia
Posts: 70
Posted: 03:08am 14 Feb 2012
Copy link to clipboard 
Print this post

  Juri74 said   maybe stickos is faster because it doesnt spent processor time to manage sd/vga/keyboard..


Reading the Stick OS website they claim the code is compiled into byte code, which could account for the faster execution of programs.
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 05:37pm 17 Feb 2012
Copy link to clipboard 
Print this post

  Geoffg said  ...
Regardless, I don't think that we can go six times faster so CoreBASIC must be sacrificing something to get that speed. I have not looked at it but perhaps it is a compiler, or uses integer maths, or something.
Geoff


Quote from their site:
"Underneath CoreBASIC is something wonderful: a complete multi-tasking operating system, CoreOS, taking full advantage of all the hardware features of the microprocessor and sophisticated software that makes all your device programming effortless."
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
paul_l_curtis
Newbie

Joined: 23/02/2012
Location: United Kingdom
Posts: 4
Posted: 02:59pm 23 Feb 2012
Copy link to clipboard 
Print this post

  Geoffg said  Regardless, I don't think that we can go six times faster so CoreBASIC must be sacrificing something to get that speed. I have not looked at it but perhaps it is a compiler, or uses integer maths, or something.

Geoff


CoreBASIC is fully interpreted. It has full floating-point mathematics including complex numbers and quaternions. You can edit your programs on the SolderCore using a telnet connection.

Not only that, but it has a full suite of matrix maths functions, arrays and vectors are first-class objects, and it has a complete object system with dynamic instantiation of built-in drivers from simple things like SPI, I2C, and UARTs through to character-based graphics on HD44780, bitmap graphics on many LCD shields, GPS, and a complete quaternion-based AHRS which can fuse any supported accelerometer, gyroscope, and optional magnetometer to provide an IMU or AHRS.

The interpreter and supporting software are engineered, not hacked together. It happens to be very fast because it was designed to be both elegant and fast. It does not sacrifice anything for speed: it is simply fast and well designed. That's all.
 
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 04:11pm 23 Feb 2012
Copy link to clipboard 
Print this post

Hi Paul

welcome, nice to see you here

sure CoreBASIC is good, and I do not want to underestimate your work, but you do not generate the video with the same chip nor handle keyboard

the single-chip-does-all video and keyboard is the charm of MM/DM

and it targets hobby/amateurs and does this pretty well, I do not remember to have had so much fun in the last few years than what I have with DuinoMite interfacing with few lines of code our UEXT modules through the UEXT connector

I doubt hobby amateur will need matrix math functions or vectors at lest not in BASIC - what I notice is that significant part of our DuinoMite sales go to people who do not use BASIC at all, today I got e-mail from small business who use DuinoMite in volume 20-50 pcs for their product and asked me if I have few prototypes of eMega as they need Ethernet, I told them that the firmware is still not ready but the reply was - I do not care for the firmware we use C in our project

What I look at for a few days is iMX233 from Freescale it's 454Mhz ARM9 with build in Video DAC and Audio input/output, designed for portable media players this is also the heart in Chumby
what I saw it I immediately though for small USB stick format computer something like the RASPBERRY PI
on one end to have Video and Audio connectors and on the opposite side USB host for keyboard, this running BASIC interpreter like MM/DM will be perfect toy for home use.
You can plug it to your TV and with one Keyboard you can play and write code.
This processor have build in Video generator so will have zero overhead in code and will have 640x480 color video output.

I pre-estimate this beast will be able to execute about 1 Million BASIC instructions per second if we keep same speed as on DuinoMite at the moment and remove the video generation and GPIO bitbang code.

will have also SD card and 32MB of RAM so if you got tired from BASIC you can boot linux for instance and develop in linux too.

UEXT and GPIOs on top side of the stick and the SD card on the bottom side.

iMX233 is priced $5.50 for 100 pcs so it would be quite possible to make $30 retail all-in-one computer with Video and Keyboard in this stick form.

Tsvetan
 
paul_l_curtis
Newbie

Joined: 23/02/2012
Location: United Kingdom
Posts: 4
Posted: 06:17pm 23 Feb 2012
Copy link to clipboard 
Print this post

  Olimex said   Hi Paul

welcome, nice to see you here

sure CoreBASIC is good, and I do not want to underestimate your work, but you do not generate the video with the same chip nor handle keyboard


That is true. But we wanted to keep to the small Arduino footprint and offer VGA and LCD to the Arduino community rather than bolt everything into a single offering. The chip we use for VGA output is an XMOS one, and the firmware is already on the web and open. The design is open. No worries. The whole VGA output is done in software, as is SPI, using an 8-thread core. The LCD runs the same protocol.

  Olimex said  the single-chip-does-all video and keyboard is the charm of MM/DM


Yes. There is no reason to doubt this, but your solution is simply different from ours.

  Olimex said  and it targets hobby/amateurs and does this pretty well, I do not remember to have had so much fun in the last few years than what I have with DuinoMite interfacing with few lines of code our UEXT modules through the UEXT connector


Indeed. But that's no different from the SolderCore supporting (at present) a huge range of shields in a consistent manner. We could (and do) support MOD-* things anyway.

  Olimex said  I doubt hobby amateur will need matrix math functions or vectors at lest not in BASIC


If you want to do a balacing robot in CoreBASIC, you can. You want to fly using CoreBASIC? Sure, you can do that too, because that's what we're working on right now (I funded a KickStarter project to do this). Don't underestimate the fact that calibrating a touchscreen using 9-point interpolation is very easy if you can solve a set of linear equations, and that is what the matrix maths are for.

  Olimex said  what I notice is that significant part of our DuinoMite sales go to people who do not use BASIC at all, today I got e-mail from small business who use DuinoMite in volume 20-50 pcs for their product and asked me if I have few prototypes of eMega as they need Ethernet, I told them that the firmware is still not ready but the reply was - I do not care for the firmware we use C in our project


SolderCore will be available without CoreBASIC. We already have customers for this.

  Olimex said  What I look at for a few days is iMX233 from Freescale...


Yes, but they are hard to program "on the metal".

  Olimex said  This processor have build in Video generator so will have zero overhead in code and will have 640x480 color video output.


It's all about software. I don't doubt that there are great pieces of hardware in the world (BeagleBone we have, along with many other high-end things), but the software is the thing that takes the time to write and debug.

  Olimex said  I pre-estimate this beast will be able to execute about 1 Million BASIC instructions per second if we keep same speed as on DuinoMite at the moment and remove the video generation and GPIO bitbang code.


For small programs, possibly. I took a look at the core of the MMBASIC code out of interest--completely different strategy to CoreBASIC for execution. However, it is not set to scale, I don't think. For large applications, with many lines and many variables, it just doesn't have the internal structure to scale well.

  Olimex said  will have also SD card and 32MB of RAM so if you got tired from BASIC you can boot linux for instance and develop in linux too.


Yep, SolderCore already has SD card supportt. And it has a TCP stack inside it, so you can drag our library of examples directly into the SolderCore using "EXAMPLE" which downloads from the soldercore.com website. And it has a web server so you can program it through the web, or display your customized content from CoreBASIC. And I can build an FTP server into it. And it gets its time from the network. And it supports a huge range of devices all inside CoreBASIC.

However, the point is that both are different philosophies--it's going to be hard to compare them.

CoreBASIC ran on ARM9s with integrated keyboard and VGA a long time ago, from 2006:

http://www.revely.com/RMS102/Documents/RIZE%20RMS102%20Produ ct%20Sheet%20A3.pdf

  Olimex said  iMX233 is priced $5.50 for 100 pcs so it would be quite possible to make $30 retail all-in-one computer with Video and Keyboard in this stick form.

Tsvetan


Without custom software, if you don't include the cost of the software in the hardware sale, I would think so.
 
paul_l_curtis
Newbie

Joined: 23/02/2012
Location: United Kingdom
Posts: 4
Posted: 06:27pm 23 Feb 2012
Copy link to clipboard 
Print this post

  Olimex said   Hi Paul

welcome, nice to see you here

sure CoreBASIC is good, and I do not want to underestimate your work, but you do not generate the video with the same chip nor handle keyboard


That is true. But we wanted to keep to the small Arduino footprint and offer VGA and LCD to the Arduino community rather than bolt everything into a single offering. The chip we use for VGA output is an XMOS one, and the firmware is already on the web and open. The design is open. No worries. The whole VGA output is done in software, as is SPI, using an 8-thread core. The LCD runs the same protocol.

  Olimex said   the single-chip-does-all video and keyboard is the charm of MM/DM


Yes. There is no reason to doubt this, but your solution is simply different from ours.

  Olimex said  and it targets hobby/amateurs and does this pretty well, I do not remember to have had so much fun in the last few years than what I have with DuinoMite interfacing with few lines of code our UEXT modules through the UEXT connector


Indeed. But that's no different from the SolderCore supporting (at present) a huge range of shields in a consistent manner. We could (and do) support MOD-* things anyway.

  Olimex said   I doubt hobby amateur will need matrix math functions or vectors at lest not in BASIC


If you want to do a balacing robot in CoreBASIC, you can. You want to fly using CoreBASIC? Sure, you can do that too, because that's what we're working on right now (I funded a KickStarter project to do this). Don't underestimate the fact that calibrating a touchscreen using 9-point interpolation is very easy if you can solve a set of linear equations, and that is what the matrix maths are for.

what I notice is that significant part of our DuinoMite sales go to people who do not use BASIC at all, today I got e-mail from small business who use DuinoMite in volume 20-50 pcs for their product and asked me if I have few prototypes of eMega as they need Ethernet, I told them that the firmware is still not ready but the reply was - I do not care for the firmware we use C in our project

SolderCore will be available without CoreBASIC. We already have customers for this.

  Olimex said   What I look at for a few days is iMX233 from Freescale


Yes, but they are hard to program "on the metal".

  Olimex said   it's 454Mhz ARM9 with build in Video DAC and Audio input/output, designed for portable media players...


It's all about software. I don't doubt that there are great pieces of hardware in the world (BeagleBone we have, along with many other high-end things), but the software is the thing that takes the time to write and debug.

  Olimex said   I pre-estimate this beast will be able to execute about 1 Million BASIC instructions per second if we keep same speed as on DuinoMite at the moment and remove the video generation and GPIO bitbang code.


For small programs, possibly. I took a look at the core of the MMBASIC code out of interest--completely different strategy to CoreBASIC for execution. However, it is not set to scale, I don't think. For large applications, with many lines and many variables, it just doesn't have the internal structure to scale well. Don't take this as a slight on the code; it is what it is, and it just happens to be different from CoreBASIC.

  Olimex said   will have also SD card and 32MB of RAM so if you got tired from BASIC you can boot linux for instance and develop in linux too.


Yep, SolderCore already has SD card supportt. And it has a TCP stack inside it, so you can drag our library of examples directly into the SolderCore using "EXAMPLE" which downloads from the soldercore.com website. And it has a web server so you can program it through the web, or display your customized content from CoreBASIC. And I can build an FTP server into it. And it gets its time from the network. And it supports a huge range of devices all inside CoreBASIC.

However, the point is that both are different philosophies--it's going to be hard to compare them.

CoreBASIC ran on ARM9s with integrated keyboard and VGA a long time ago, from 2006:

http://www.revely.com/RMS102/Documents/RIZE%20RMS102%20Produ ct%20Sheet%20A3.pdf

  Olimex said   iMX233 is priced $5.50 for 100 pcs so it would be quite possible to make $30 retail all-in-one computer with Video and Keyboard in this stick form.


If you don't include the cost of developing any offered software in the hardware sale, I would think so.
 
jlder
Newbie

Joined: 30/09/2012
Location: France
Posts: 2
Posted: 11:01pm 28 Oct 2012
Copy link to clipboard 
Print this post

I am a little bit confused.
Is CoreBasic available to the PIC32 and/or the DuinoMite?

JL
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 04:18am 29 Oct 2012
Copy link to clipboard 
Print this post

No - different product all together.
Micromites and Maximites! - Beginning Maximite
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024