Menu
JAQForum Ver 26.09

Forum Index : Microcontroller and PC projects : PicoMite - integrated compact C-compiler / C-runtime

   Page 3 of 6    
Posted: 01:31pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

A quick comparison:

Print "Benchmark 4"
Timer = 0
j = 0
BM4:
j = j+1
a = j/2*3+4-5
If j < 1000 GoTo BM4
Print Timer / 1000
Print " "


1,000,000 iterations for the C version

#include <stdio.h>
#include <time.h>

int main(void) {
   puts("Benchmark 4 (1,000,000 iterations)");
   
   clock_t start = clock();
   
   double j = 0;
   double a = 0;
   
   // Scaled up to 1 Million iterations
   while (j < 1000000.0) {
       j = j + 1.0;
       a = j / 2.0 * 3.0 + 4.0 - 5.0;
   }
   
   clock_t end = clock();
   double elapsed_seconds = (double)(end - start) / CLOCKS_PER_SEC;
   
   printf("Time for 1M iterations: %f seconds\n", elapsed_seconds);
   
   return 0;
}



 
Posted: 02:19pm
04 Nov 2026
Copy link to clipboard
matherp
Guru

That's slow

I've just implemented my Fuzix C compiler on the CMM2

 
Posted: 02:52pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

Awesome    Is there no end to this awesomeness  

My 1.5s was @200MHz, drops to 0.73s @420MHz
Edited 2026-11-05 00:53 by PhenixRising
 
Posted: 02:55pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  PhenixRising said  Awesome    Is there no end to this awesomeness  

My 1.5s was @200MHz, drops to 0.73s @420MHz


you can also try:
1. build .elf by TCC command before the start
2. build .elf by gcc on host before the start
3. try float instead of double (it much faster on RP2350, because of hardware acceleration, aka FPU)
 
Posted: 02:57pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  MikeV73 said  
  PhenixRising said  
2. build .elf by gcc on host before the start


Simple example of GCC call:
https://github.com/DnCraptor/pico-mm/blob/main/example_elf.bat
-O1 may be replaced by -O3 for better performance
 
Posted: 03:19pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

Hi Mike,

Elf is slightly faster but:

Double: 0.73s
Float: 0.961s
 
Posted: 03:22pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  PhenixRising said  Hi Mike,

Elf is slightly faster but:

Double: 0.73s
Float: 0.961s


Ok. Thnx. Will investigate. It looks, FPU is not used at all. May be some bug in builds. It is expected to use gcc wrappers for FPU calls, and may be they linked to soft-emulation, instead of hardware.
 
Posted: 05:11pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  PhenixRising said  Hi Mike,

Elf is slightly faster but:

Double: 0.73s
Float: 0.961s


it looks like you used not pure float, but "mixed" code, with double and with float, so with a lot of conversions. Pls. use float in variables and constants. Like:

float j = 0.0f;
float a = 0.0f;

while (j < 1000000.0f) {
   j = j + 1.0f;
   a = j / 2.0f * 3.0f + 4.0f - 5.0f;
}

Edited 2026-11-05 03:13 by MikeV73
 
Posted: 05:14pm
04 Nov 2026
Copy link to clipboard
toml_12953
Guru

  MikeV73 said  
  toml_12953 said  
  Frank N. Furter said  I thought that was normal? After all, it's not a BASIC program...

Frank


Maybe you could test the first character of the file. If it's not # or /, you could run it as a BASIC program but if it is one of those two, run it as a C program. Just a thought.


Actually fixed. RC2 was provided.
It uses extension to detect a type of program.
.bas - usual flow
.c - specific for C
and for ELF-files it uses "magic" sign in first 4 bytes of the file.


Suppose I type in a program and, before I save it to a drive, I want to test it. For BASIC, I can hit F2 in the editor and it will run. Also, at the command line the RUN command will run the program as long as it's still in the editor. Can a C program be run the same way? If not, that's why I suggested the first character of the file rather than the extension. Before it's saved, it has no extension.
 
Posted: 05:21pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  toml_12953 said  
Suppose I type in a program and, before I save it to a drive, I want to test it. For BASIC, I can hit F2 in the editor and it will run. Also, at the command line the RUN command will run the program as long as it's still in the editor. Can a C program be run the same way? If not, that's why I suggested the first character of the file rather than the extension. Before it's saved, it has no extension.


Yes, since RC2 F2 starts your .c-program (in EDIT).
Do not use unnamed files for this, open it by
EDIT "my_new.c"

instead of just
EDIT

Edited 2026-11-05 03:22 by MikeV73
 
Posted: 05:53pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

Holy COW

RP2350B @420MHz




Back to 300MHz



Edited 2026-11-05 04:01 by PhenixRising
 
Posted: 05:57pm
04 Nov 2026
Copy link to clipboard
hhtg1968
Guru

@MikeV73:

how do you convert by mmbasic program pico-lifepx to c? by AI or manually?

pro AI:
short time to convert

pro human:
cool converting AND speeding up
 
Posted: 06:00pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  hhtg1968 said  @MikeV73:

how do you convert by mmbasic program pico-lifepx to c? by AI or manually?

pro AI:
short time to convert

pro human:
cool converting AND speeding up


AI was used. I stopped to write code manual, some times ago. AI do it faster, sometimes it mistakes, but I'm mistake more often ))
 
Posted: 06:01pm
04 Nov 2026
Copy link to clipboard
hhtg1968
Guru

the version rc2 f2 is cool.

starting .c and .elf from fm is fine.

syntax highlighting for c?

I wrote an simple editor last year. the coding of syntax highlighting costs energy. so I found a library in the internet and it was fast integrated.

or needs it too much memory?
 
Posted: 06:04pm
04 Nov 2026
Copy link to clipboard
MikeV73
Regular Member

  hhtg1968 said  the version rc2 f2 is cool.

starting .c and .elf from fm is fine.

syntax highlighting for c?

I wrote an simple editor last year. the coding of syntax highlighting costs energy. so I found a library in the internet and it was fast integrated.

or needs it too much memory?


I'm thinking about specific standalone editor for C. I do not want to expand flash consumption a lot.
 
Posted: 06:20pm
04 Nov 2026
Copy link to clipboard
hhtg1968
Guru

@MikeV73:
do you know how the editor of mmbasic makes the highlighting? my editor has different tables for the different languages. it could be not to need so much more memory...
Edited 2026-11-05 04:20 by hhtg1968
 
Posted: 06:30pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

I am using a bare RP2350B-DIL module which means using the PC console. If I try to use the onboard editor, it messes-up and so I edit in NP++

I have UTF-8 set but when I send the file to the PicoMite, the compiler errors-out with "unexpected character".

I'm not experienced with setting these things up BUT I can make it work by:

  Quote  > XMODEM CRUNCH

Instead of XMODEM RECEIVE
Then I send the file via XMODEM in Teraterm and all is good  
 
Posted: 08:43pm
04 Nov 2026
Copy link to clipboard
bfwolf
Senior Member

  PhenixRising said  I am using a bare RP2350B-DIL module which means using the PC console. If I try to use the onboard editor, it messes-up and so I edit in NP++

I have UTF-8 set but when I send the file to the PicoMite, the compiler errors-out with "unexpected character".

I'm not experienced with setting these things up BUT I can make it work by:

  Quote  > XMODEM CRUNCH

Instead of XMODEM RECEIVE
Then I send the file via XMODEM in Teraterm and all is good  


I seem to recall observing that, with XMODEM, files are padded to multiples of 64 or 128 bytes — possibly with null bytes? That might explain it. I believe YMODEM and ZMODEM don’t have this quirk; instead, they transmit files at their exact length.
 
Posted: 10:24pm
04 Nov 2026
Copy link to clipboard
PhenixRising
Guru

Dunno, I kinda thought that MMEdit's CRUNCH would be the same but there is a lot that I don't know.

You know what it's like when you just want your darned code to run  

This is all super exciting stuff.
COMPILE ON gives me more than I need but heck, I love breaking barriers.

What a system we have here  
 
Posted: 10:21am
05 Nov 2026
Copy link to clipboard
JohnS
Guru

XMODEM padded to 128 (with Ctrl-Z chars IIRC).

Probably due to early OS file size allocation e.g. CP/M

John
 
   Page 3 of 6    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026