Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:29 17 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 5 of 5    
Author Message
MikeV73
Regular Member

Joined: 03/07/2025
Location: Ukraine
Posts: 47
Posted: 11:44pm 13 Nov 2026
Copy link to clipboard 
Print this post

  toml_12953 said  
  MikeV73 said  + RC5 (based on PicoMite V7.00.00RC9): https://github.com/DnCraptor/pico-mm/releases/tag/PicoMite-V7.0.00b9-tcc-elf-RC5


Thank you! There shouldn't be too many revisions left before the final.


I guess, finally it will be included into main repo ))
https://github.com/UKTailwind/PicoMite/pull/152 - PR to original repo. Not sure, UKTailwind plans about it.
Also, it may be just rejected ¯\_(ツ)_/¯
Edited 2026-11-14 09:44 by MikeV73
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 1198
Posted: 10:04am 14 Nov 2026
Copy link to clipboard 
Print this post

Thank you so much for the great update!
I went ahead and updated my PicoCalc right away.

Frank
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 678
Posted: 08:35pm 14 Nov 2026
Copy link to clipboard 
Print this post

Great work MikeV73, runs flawlessly. Plese continue support for new versions from Peter. Many thanks,

Gerald
                                                                 
73 de OE1HGA, Gerald
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 275
Posted: 05:29pm 15 Nov 2026
Copy link to clipboard 
Print this post

Do you think it might be possible to integrate SQLite into your PicoMite version via a CSUB — much like Peter has managed to do for the CMM2 — perhaps by using a precompiled .elf file?

I think it would be fantastic if Peter accepted your PR and the C extension made it into the mainline!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 12234
Posted: 06:33pm 15 Nov 2026
Copy link to clipboard 
Print this post

Thanks to everyone who has asked about the C compiler in Mike's pico-mm fork, and thanks to Mike (DnCraptor on GitHub) for doing it. Getting TinyCC to compile and run C on the PicoMite itself, with C CSUBs built from source, a loader for ELF objects and a large API into the firmware, is an impressive piece of work, and a lot of it went in very quickly.

I've had a proper look, and I've decided not to bring it into the standard MMBasic/PicoMite firmware. That isn't a judgement on Mike's work. It's about what the standard firmware is for, and who pays for what.

Everyone would pay for it
• It adds about 285KB of flash to every RP2350 build and about 73KB to every RP2040 build. The RP2040 gets the loader and the API but no compiler.
• To make room, the flash layout has to move on every build. Updating would reset everyone's options, and on the RP2040 the A: drive and the library would be wiped and come back about 96KB smaller.
• On the WebMite and Bluetooth RP2350 builds, boards without PSRAM would lose some of the flash that OPTION COMPILE ON uses, so the largest programs could no longer be compiled.
Those figures come from the fork's own build notes, compared with the RC9 builds.

Few could use it
In practice the compiler needs PSRAM, and the fork's own documentation says so. Most boards would carry the cost of a feature they can't really use.

MMBasic is a BASIC
Part of MMBasic's appeal is that a mistake in a program gives you an error message, not a crashed machine. C running natively inside the firmware doesn't work that way. CSUBs already allow it, but they're a deliberate route for people who know what they're doing, not something you get by typing RUN "x.c". Where I've done C myself, on the PC3 under Fuzix and on the CMM2, the compiler is a separate program rather than part of the firmware, and I think that's the right shape for it.

Looking after it
Besides the compiler, the fork reworks a good deal of the interpreter's own code and adds an API that's already at version 35. Anything in the standard firmware is something I have to keep working, document and answer questions about in every release, and I can't take on something this size alongside MMBasic itself.

So, use the fork
None of this stops anyone using it; that's what forks are for. If you want C on the board, try pico-mm and report back to Mike. I'd really encourage Mike to keep it merged with each of my releases so it stays current: it's based on the source from 3 November, and quite a lot has changed since.

Thanks again, Mike. It's an interesting project and I hope it keeps going.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2156
Posted: 07:28pm 15 Nov 2026
Copy link to clipboard 
Print this post

  matherp said   I hope it keeps going.


X 1,000,000  
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 275
Posted: 08:32pm 15 Nov 2026
Copy link to clipboard 
Print this post

  matherp said  Thanks to everyone who has asked about the C compiler in Mike's pico-mm fork, and thanks to Mike (DnCraptor on GitHub) for doing it. Getting TinyCC to compile and run C on the PicoMite itself, with C CSUBs built from source, a loader for ELF objects and a large API into the firmware, is an impressive piece of work, and a lot of it went in very quickly.

I've had a proper look, and I've decided not to bring it into the standard MMBasic/PicoMite firmware. That isn't a judgement on Mike's work. It's about what the standard firmware is for, and who pays for what.

Everyone would pay for it
• It adds about 285KB of flash to every RP2350 build and about 73KB to every RP2040 build. The RP2040 gets the loader and the API but no compiler.
• To make room, the flash layout has to move on every build. Updating would reset everyone's options, and on the RP2040 the A: drive and the library would be wiped and come back about 96KB smaller.
• On the WebMite and Bluetooth RP2350 builds, boards without PSRAM would lose some of the flash that OPTION COMPILE ON uses, so the largest programs could no longer be compiled.
Those figures come from the fork's own build notes, compared with the RC9 builds.
...


I understand your reasoning and arguments, and I largely agree with them: including a C compiler by default doesn't make much sense, as it would add a significant amount of code to the binary — thereby noticeably shrinking the space available on drive A:, at least on the Pico1 or RP2040 boards, which only have 2MB of flash. Furthermore, a C compiler is "fairly pointless" without PSRAM; while it might be able to compile simple "Hello, World!" programs, any serious application would quickly hit its limits.

Regarding the RP2350, I would be in favor of including an .elf loader, provided the overhead isn't too great. This would allow .elf files to be generated — either on boards equipped with PSRAM (using the version from the fork) or via a cross-compiler running on Linux, Windows, etc.

However, I’m not sure how much additional code an .elf loader and a C runtime would actually require. Is it the 73kB you mentioned for the RP2040? On the RP2350, which has at least 4MB of flash, that would certainly be an acceptable trade-off. On the RP2040, it would simply have to be omitted — as is the case with "minimal" builds anyway.

  matherp said  ...
So, use the fork

None of this stops anyone using it; that's what forks are for. If you want C on the board, try pico-mm and report back to Mike. I'd really encourage Mike to keep it merged with each of my releases so it stays current: it's based on the source from 3 November, and quite a lot has changed since.

Thanks again, Mike. It's an interesting project and I hope it keeps going.


I intend to keep using this fork, and I truly hope that MikeV73 continues working on it! It works perfectly on the Pimoroni Pico+2, and even without PSRAM, you can load and execute .elf files directly! Kudos for the work! And, once again, many thanks for your own contributions as well, Peter!

Regards, bfwolf
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 2156
Posted: 09:17pm 15 Nov 2026
Copy link to clipboard 
Print this post

Although I confess to only limited testing, thus far, the RP2350B-DIL without PSRAM works just fine. I simply translate a few small functions where the fastest execution can benefit the overall performance. Many areas, I would only be "waiting faster". Loving this stuff  
 
MikeV73
Regular Member

Joined: 03/07/2025
Location: Ukraine
Posts: 47
Posted: 10:05pm 15 Nov 2026
Copy link to clipboard 
Print this post

Actually .elf-loader may be optimized by size. It was not my initial goal... so, the size of impl. was not in the priority.

About API and TCC... I guess, it is possible to provide it as separate .bas-file (with CSUB really implemeting the tcc).
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 746
Posted: 04:45am 16 Nov 2026
Copy link to clipboard 
Print this post

How is pm_timer_us supposed to work? In the following program (hat.c) the hat is drawn properly but I am trying to display the run time and I keep getting 0. How should I be doing it?

#include <stdio.h>
#include <math.h>
#include <picomite.h>
int main(void)
{
   unsigned long long m=pm_timer_us();
   pm_cls(PM_BLACK);
   int p=160, q=160, zi;
   double xp=144, xr=1.5*3.1415927;
   int yp=56, yr=1, zp=64;
   double xf=xr/xp, yf=yp/yr, zf=xr/zp;

   for (zi = -q; zi <= q - 1; zi++) {
       double zt,zz;
       int xx,xl,xi;
       if (zi < -zp || zi > zp)
           continue ;
       zt=zi*xp/zp; zz=zi;
       xl=floor(0.5+sqrt(xp*xp-zt*zt));
       for (xi=-xl; xi<=xl; xi++) {
           double xt,yy,x1,y1;
           xt=sqrt(xi*xi+zt*zt)*xf; xx=xi;
           yy=(sin(xt)+0.4*sin(3*xt))*yf;
           x1=xx+zz+p;
           y1=320-(yy-zz+q);
           pm_pixel(x1, y1, PM_WHITE);
           if (y1 != 320)
               pm_line(x1,y1+1,x1,320-1,1,PM_BLACK);
       }
   }
   m=pm_timer_us()-m;
   printf("Time: %5u seconds\n",m);
}


I managed to solve the problem. Here's what I did at the end of the program:

m=pm_timer_us()-m;
double n=m/1000000.0
printf("Time: %f seconds\n",n);

Edited 2026-11-16 15:16 by toml_12953
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4400
Posted: 01:39pm 16 Nov 2026
Copy link to clipboard 
Print this post

Looks like %u needed one or more l as m is not an unsigned int (it's much "longer").

John
 
MikeV73
Regular Member

Joined: 03/07/2025
Location: Ukraine
Posts: 47
Posted: 03:19pm 16 Nov 2026
Copy link to clipboard 
Print this post

Reviewed.

`pm_timer_us()` is working correctly. I've checked the implementation: it returns a 64-bit `unsigned long long` value in microseconds.

As JohnS pointed out, `%u` expects a 32-bit `unsigned int`, so the format specifier is incorrect.

To display microseconds:
printf("Time: %llu us\n", m);


Or seconds:
printf("Time: %.3f seconds\n", (double)m / 1000000.0);


No firmware changes are needed. I'll add an example to the API documentation to avoid confusion.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 746
Posted: 05:37pm 16 Nov 2026
Copy link to clipboard 
Print this post

  MikeV73 said  Reviewed.

`pm_timer_us()` is working correctly. I've checked the implementation: it returns a 64-bit `unsigned long long` value in microseconds.

As JohnS pointed out, `%u` expects a 32-bit `unsigned int`, so the format specifier is incorrect.

To display microseconds:
printf("Time: %llu us\n", m);


Or seconds:
printf("Time: %.3f seconds\n", (double)m / 1000000.0);


No firmware changes are needed. I'll add an example to the API documentation to avoid confusion.


Yeah, I found out how to do it. I listed the correction in a footnote. I'm really disappointed that your wonderful effort won't be included in the mainstream builds. I hope you'll keep making it available on your own, though. It's too valuable to lose!
 
     Page 5 of 5    
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026