Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:57 01 Aug 2025 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 : MMBasic on ARM, worth the effort?

     Page 1 of 4    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 01:54am 19 Feb 2015
Copy link to clipboard 
Print this post

I spent yesterday getting the rudiments of the Micromite code working on the STM32F407VG chip (1M flash, 192K RAM, 168MHz clock, hardware FPU).

I'm using one of the very cheap STM32F4-discovery boards as the development hardware and the free CoIDE IDE and GCC32 compiler (same compiler as Microchip use)

I've got to the point that the console is working and I've set up a 1msec interrupt timer. Basic is operational from the command line but there is no facility to save a program.

Although there is 192K of memory, this is split into 128K and 64k sections which makes it more difficult to use. At the moment the code is only using the 128K bit.

Before putting in any more effort I though I'd try and run a simple benchmark to test the comparable performance - results below.

Basically the performance appears to scale pretty much 1:1 with the relative clock speeds. Comments?

If its not clear on the picture the times are:
ARM@168Mhz 5598
470@96Mhz 8712
170@48MHz 13626



Edited by matherp 2015-02-20
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 03:06am 19 Feb 2015
Copy link to clipboard 
Print this post

If you do any more you might like to use the 429 Discovery board, as it has 2MB flash, 256K RAM and 8MB SDRAM (plus a 2.4" LCD & HS/FS USB OTG)

BTW, wasn't (isn't?) there a Germany-based project on similar lines?

Or you might like to use an Allwinner A10/A20 board. They tend to be about 1GHz and 512MB/1GB RAM. Some have 2GB/4GB NAND flash too.

Example: Olimex A10-OLinuXino-LIME

JohnEdited by JohnS 2015-02-20
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 04:17am 19 Feb 2015
Copy link to clipboard 
Print this post

Looking at the specs it is a very interesting chip.
But!, without support for most of the peripherals it would be a waste of time.
The question then becomes how easy it is to support the i2c,spi,can,usb,sd,lcd,etc.
That could cost a huge amount of time. I am not familiar with the programming environment and the availability of libraries.
I actually have exactly the same discovery board on the way. I will have to wait with a real opinion when i get something done on it. :)



Microblocks. Build with logic.
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 05:03am 19 Feb 2015
Copy link to clipboard 
Print this post

This sure waters everything down. Hard to talk to somebody about MMBasic, Maximite, and Micromite when all these chips end up having different implementations.
Micromites and Maximites! - Beginning Maximite
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 06:35am 19 Feb 2015
Copy link to clipboard 
Print this post

ST provide samples for all their peripherals. All on their website. Free download.

John
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 09:10am 19 Feb 2015
Copy link to clipboard 
Print this post

fantastic.

maybe we can build it together ?
 
pito
Newbie

Joined: 09/06/2011
Location:
Posts: 25
Posted: 09:48am 19 Feb 2015
Copy link to clipboard 
Print this post

  Quote  Although there is 192K of memory, this is split into 128K and 64k sections which makes it more difficult to use. At the moment the code is only using the 128K bit.

There is a mechanism in the compiler/linker which joints the 128 and 64 chunks into a single 192k one. I did it with stm32F407 and it worked.
F4 ram alocator
Edited by pito 2015-02-20
 
darthmite

Senior Member

Joined: 20/11/2011
Location: France
Posts: 240
Posted: 11:06pm 20 Feb 2015
Copy link to clipboard 
Print this post

If you need example on how to use a st429 with 'more' SDRAM , VGA (LCD) , Mod player ,
Sprites (like maximite) you can look at my code on this page :
st429 examples
This was my 'old' st429 test.
Actually i have added the PS2 Keyboard and a mouse 'modified PS2) , and that to a
800 x 480 LCD , the perf are 112 FPS (thanks the LTDC and DMA2D) , the 'video' is put
on screen from the DMA2D , you just have to drop your pixels into the SDRAM and the
system made everything alone 'it's why i use the st429 !! '
My last test on this new board are here :
Latest test on 800x480 LCD

@matherp : It will be 'very' good if you post your code that we can test it too
Here i will have to convert your project to Keil MDK ....

Cheers.

Darth.

Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 11:40pm 20 Feb 2015
Copy link to clipboard 
Print this post

Darth/pito

You are both way ahead of me in STM32 skills

My code is just the download you can get from Geoff's site with all of the hardware specifics stripped out and a UART driver cobbled in. Other than that I've just enabled systick as the background timer. PM me for more details - I can't post the code as it is properly subject to Geoff's licence rules.

I've now set up a loader script so the stack, heap and bss (whatever that is) are now in the 64K section of RAM leaving 128 for MMBasic which is more than enough.

The next challenge is to get the ability to store the user Basic code in flash. This doesn't look very good as the STM32 has very large flash sections. On the Microchip you can erase/store 1K (mx170) or 4k (mx470) sections at a time. On the STM the higher memory sections are 128k each.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 12:16am 21 Feb 2015
Copy link to clipboard 
Print this post

bss is the uninitialised RAM.

(b=blank)

In C it gets set to all bits zero, so uninitialised is sort of "not explicitly set to a value". Note that floating point values are not set to 0.0 unless that happens on a specific CPU to be the same as all bits zero.

So,
static int i; // will be zero
static float f; // eek, dragons here!!

Good habit: initialise things especially as a beginner :)

JohnEdited by JohnS 2015-02-22
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:39am 21 Feb 2015
Copy link to clipboard 
Print this post

Would storing the basic in an external flash be an option?
And load the basic program into ram to executed it? (Like the maximites do from an SD)
Dumping a block of memory from/to a serial flash device is actually pretty simple.
A little less ideal of course then on the pic but maybe a good compromise.
Would running from ram actually be faster? Or are the wait states for flash and ram equal.
I am not an STM32 expert either.

<rant>
I am now actually looking for another reseller for the discovery board because i had to sign papers and send documents declaring i am not a terrorist or use it for weapons of mass destruction. I don't want to do that silly stuff for just a simple piece of electronics. Where does it stop?
That was RS btw.
</rant>

Edited by TZAdvantage 2015-02-22
Microblocks. Build with logic.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 12:46am 21 Feb 2015
Copy link to clipboard 
Print this post

Yeah, when I got some UBW32 boards from America(Sparkfun) late last year, they asked me the same thing. It's turning into a strange world....
Smoke makes things work. When the smoke gets out, it stops!
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 12:52am 21 Feb 2015
Copy link to clipboard 
Print this post

  TZAdvantage said  
<rant>
I am now actually looking for another reseller for the discovery board because i had to sign papers and send documents declaring i am not a terrorist or use it for weapons of mass destruction. I don't want to do that silly stuff for just a simple piece of electronics. Where does it stop?
That was RS btw.
</rant>



I suggest you better sign those papers, otherwise you will leave them with the impression that you are a terrorist

http://rittle.org

--------------
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 01:35am 21 Feb 2015
Copy link to clipboard 
Print this post

  Quote  Would storing the basic in an external flash be an option?
And load the basic program into ram to executed it? (Like the maximites do from an SD)
Dumping a block of memory from/to a serial flash device is actually pretty simple.
A little less ideal of course then on the pic but maybe a good compromise.
Would running from ram actually be faster? Or are the wait states for flash and ram equal.


This goes against the single chip concept but it does have attractions. The code would definitely run faster; at 168Mhz reading a word of flash requires processor wait states, can't remember exactly how many but it was in the datasheet and was something like 5 or 6!
The downside is that code and data share the same limited RAM

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 02:29am 21 Feb 2015
Copy link to clipboard 
Print this post

  TZAdvantage said  <rant>
I am now actually looking for another reseller for the discovery board because i had to sign papers and send documents declaring i am not a terrorist or use it for weapons of mass destruction. I don't want to do that silly stuff for just a simple piece of electronics. Where does it stop?
That was RS btw.
</rant>


It's the USA. They haven't changed worth a darn for decades. I once had to calculate arcane details of a minicomputer (VAX-11/780) - wait for it - for export from England. Yes! we had to work out US government rules to be able to export it.

Known as "extraterritoriality" i.e. we (the USA, here) extend our laws into other jurisdictions where we have no actual power but say (pretend?) we do.

Goes back even further - UNIX was shipped without the encryption (& decryption) code because it counted as a WEAPON. Good ol' Uncle Sam.

There's a fun story about one of the 2 main guys behind UNIX (Ken Thompson) having to get rid of equipment he'd taken with him out of the country rather than re-import it. Sad but true.

---

The fix is to STOP USING USA devices. Use Allwinner ones, for example. Now that's a "win" for the USA, right???

John
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:58am 21 Feb 2015
Copy link to clipboard 
Print this post

  matherp said  
The downside is that code and data share the same limited RAM

For the ST that actually might work ok as the 64KB and 128KB are separate sections anyway.
It might simplify the port.
FRAM would work great for that.like these I2C and SPI parts.

Edited by TZAdvantage 2015-02-22
Microblocks. Build with logic.
 
darthmite

Senior Member

Joined: 20/11/2011
Location: France
Posts: 240
Posted: 03:38am 21 Feb 2015
Copy link to clipboard 
Print this post

The SDRAM on st429 is easy to use , for example you want put your mmbasic source ,
etc into SDRAM after the graphics buffer , with my driver i just have to made :

in header file:

// MMBasic buffer as pointer array
extern uint32_t *MMBas_Buf;


now in the *.c :


// MMBasic buffer as pointer array
uint32_t *MMBas_Buf = (uint32_t *)VIDEO_MEMORY_END;


MMBasic can access it like a simple array just limited from the SDRAM Space
And because it's a global variable you access it from everywhere ...
That was just one example , here i use 32bits , and for a simple MM Source in text is
better to use char or uint8_t as always ....

For the source it's not a problem , i still have it , i asked for it just to not reinvent the wheel

Cheers.
Edited by darthmite 2015-02-22
Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 04:30am 21 Feb 2015
Copy link to clipboard 
Print this post

  JohnS said  
The fix is to STOP USING USA devices.
John



ST is actually an European company... (France)
It is the ridiculous export laws in the US, not the nationality of the manufacturer, what I see is the problem. I had a similar one with Altera some years ago and never got the board even after signing a number of documents.




Edited by kiiid 2015-02-22
http://rittle.org

--------------
 
darthmite

Senior Member

Joined: 20/11/2011
Location: France
Posts: 240
Posted: 05:33am 21 Feb 2015
Copy link to clipboard 
Print this post

@ TZAdvantage:
PM me your address , i send you a st429 disco for free , i got 4 lying around here and 1 is not in use
From France is not a problem to send stuff to Thailand

Cheers.

PS : I got mine from Farnell Element14 (French page) ... just in case ...

Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 08:51am 21 Feb 2015
Copy link to clipboard 
Print this post

@Darth, that is a great offer! Thank you very much.


Microblocks. Build with logic.
 
     Page 1 of 4    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025