Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:25 07 Nov 2026 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 : PicoMite - integrated compact C-compiler / C-runtime

     Page 3 of 4    
Author Message
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 01:31pm 04 Nov 2026
Copy link to clipboard 
Print this post

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;
}



 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 12129
Posted: 02:19pm 04 Nov 2026
Copy link to clipboard 
Print this post

That's slow

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

 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 02:52pm 04 Nov 2026
Copy link to clipboard 
Print this post

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
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 02:55pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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)
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 02:57pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 03:19pm 04 Nov 2026
Copy link to clipboard 
Print this post

Hi Mike,

Elf is slightly faster but:

Double: 0.73s
Float: 0.961s
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 03:22pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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.
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 05:11pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 740
Posted: 05:14pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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.
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 05:21pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 05:53pm 04 Nov 2026
Copy link to clipboard 
Print this post

Holy COW

RP2350B @420MHz




Back to 300MHz



Edited 2026-11-05 04:01 by PhenixRising
 
hhtg1968
Guru

Joined: 25/05/2023
Location: Germany
Posts: 303
Posted: 05:57pm 04 Nov 2026
Copy link to clipboard 
Print this post

@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
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 06:00pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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 ))
 
hhtg1968
Guru

Joined: 25/05/2023
Location: Germany
Posts: 303
Posted: 06:01pm 04 Nov 2026
Copy link to clipboard 
Print this post

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?
 
MikeV73
Newbie

Joined: 03/07/2025
Location: Ukraine
Posts: 39
Posted: 06:04pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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.
 
hhtg1968
Guru

Joined: 25/05/2023
Location: Germany
Posts: 303
Posted: 06:20pm 04 Nov 2026
Copy link to clipboard 
Print this post

@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
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 06:30pm 04 Nov 2026
Copy link to clipboard 
Print this post

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  
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 264
Posted: 08:43pm 04 Nov 2026
Copy link to clipboard 
Print this post

  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.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2143
Posted: 10:24pm 04 Nov 2026
Copy link to clipboard 
Print this post

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  
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4395
Posted: 10:21am 05 Nov 2026
Copy link to clipboard 
Print this post

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 4    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026