|
Forum Index : Microcontroller and PC projects : PicoMite - integrated compact C-compiler / C-runtime
| Author | Message | ||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 270 |
I think, this will be an interesting possibility: https://www.thebackshed.com/forum/ViewTopic.php?TID=19209&P=1#260985 "4. Use C functions inside BASIC (RP2350 only). Write a CSUB in C instead of manually creating hexadecimal machine code. PicoMite compiles it when saving the BASIC program. The CSUB then runs directly from flash. Example: C CSUB" https://github.com/DnCraptor/pico-mm/blob/tcc/Bas/pm_library_csub_tcc.bas |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
Please help a C beginner ... what's wrong here? > > list "x.c #include <stdio.h> int main(int argc, char **argv) { printf("Hello from C, argc=%d\n", argc); For (int i = 1; i < argc; i++) printf(" argv[%d] = %s\n", i, argv[i]); Return 0; } > > > run "x.c x.c:6: warning: implicit declaration of function 'For' x.c:6: error: identifier expected Error : C compilation failed > Tnx, Gerald 73 de OE1HGA, Gerald |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
capitalisation. C is case secisitive lang. it should be "for", not "For", and "return", not "Return" |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
ouch ... thank you. Had a C/C++ course 30 years ago. Used it only once in 1999 to get a DCF77 NTP server Y2k ready which the vendor refused to do saying it was impossible. Was rather trivial then. But now all memories of C have faded away. 73 de OE1HGA, Gerald |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
UPD: + RC3: https://github.com/DnCraptor/pico-mm/releases/tag/PicoMite-V7.0.00b8-tcc-elf-RC3 What's new since RC2 1. Resident keyboard remapping - New C API for remapping physical keyboard input (PS/2 and USB). - Key press, release, repeat and modifier events. - Callbacks remain active across BASIC RUN and END. - New printable-character classification hook for console, EDIT and FM. 2. Russian keyboard support (KeyRus) - Resident EN/RU keyboard remapper using Windows-1251. - Ctrl+Shift switches between layouts. - Includes an 8x16 Cyrillic font (#10). - Works on RP2350 (TinyCC) and RP2040 (precompiled ELF). - Includes install, start and stop scripts. - Supports automatic startup with OPTION AUTORUN ON. Source: KeyRus files and examples 3. C syntax highlighting in EDIT - Syntax colours for .c and .h files. - Keywords, directives, comments, strings and numbers. - Recognises native PicoMite C API functions. - Different colours for functions unavailable or restricted in CSUB. - Works on the local display and ANSI terminals. 4. Console font API - Added pm_set_console_font() for resident-controlled console fonts. - Custom fonts can be used in the console and EDIT. - Fixed lost FM colours when using custom fonts in video mode 1. Bug fixes - OPTION LOGGING no longer writes extra bytes or garbage after error messages (#139). - MM.INFO(USB VID/PID n) now returns 0 for unused channels (#142). - PLAY TONE and PLAY SOUND now play at the correct speed and pitch after WAV/MOD playback or a USB connection sound (#145). - Fixed Python detection when embedding TinyCC headers during RP2350 builds. Native C API Updated to API v35, adding keyboard remapping, printable-character classification and console font control. KeyRus quick start Copy the KeyRus files to the PicoMite filesystem, then run: RUN "key_rus_install.bas" To stop: RUN "key_rus_stop.bas" To enable automatic startup, load key_rus_start.bas into the program memory and use: OPTION AUTORUN ON Changes since RC2 Full comparison: RC2 to RC3 RC3 source commit: 67a9e5477 Edited 2026-11-06 02:06 by MikeV73 |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
Actually, any language may be provided, and russian with cp1251 - just techno demo. |
||||
| PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 2149 |
I just take MMBasic code and have Gemini translate to C I also set: |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
nah, want to write my own C code in the first place. AI may come later after I have understood C a bit more. But tnx for the hint with option case lower. 73 de OE1HGA, Gerald |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
MikeV73, I think there is some instability in FM in your latest build. FM crashes when selecting and deleting files, sometimes just when navigating. Example: 208 x.c | 207 x.cmd 208 x.c.bak | 202 x.cmd.bak 207 x.cmd | 67 y.cmd 202 x.cmd.bak | 67 y.cmd.bak 67 y.cmd | 66 z.cmd 67 y.cmd.bak | 66 z.cmd |*** FAULT PC=100069FC LR=100069D5 SP=200808E0 CFSR=00008200 HFSR=40000000 *** FAULT R0=01000000 R1=00000000 R2=0000000C R3=40828000 R12=00000180 XPSR=09100000 FAR=40828230 EXC=FFFFFFE9 Total of 5 Mbytes PSRAM available In the example above, there were A: and B: drive used. The same FM operations with the latest MMBasic version from Peter has no issues insofar. Environment: PicoMitePC3 MMBasic USB RP2350B Edition V7.00.00RC7 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION SYSTEM I2C GP20,GP21 OPTION FLASH SIZE 16777216 OPTION COLOURCODE ON OPTION CASE LOWER OPTION KEYBOARD GR OPTION HEARTBEAT OFF OPTION PICO OFF OPTION RESOLUTION 1280x720 @ 372000KHz OPTION DISPLAY 30, 80 OPTION HDMI PINS 1, 3, 5, 7 OPTION WIFI JN88fg, *********, PC3-2 OPTION SDCARD GP33, GP30, GP31, GP28 OPTION AUDIO I2S GP10,GP22', ON PWM CHANNEL 11 OPTION RTC AUTO ENABLE OPTION COUNT GP34,GP35,GP36,GP37 OPTION COMPILE ON OPTION PLATFORM PICO COMPUTER 3 OPTION DEFAULT FONT 3, 1 OPTION PSRAM PIN GP47 Gerald 73 de OE1HGA, Gerald |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
Thanks, Gerald, for the detailed report! The fault information is very useful. Could you please clarify a few things? 1. Which exact UF2 build are you testing? A filename or download link would help. 2. Does FM crash on A: only, B: only, or both? Does it happen while navigating, selecting a file, or confirming deletion? 3. Can you reproduce it reliably, or does it happen randomly? 4. Does it still happen with `OPTION COMPILE OFF` after reboot? 5. If possible, could you also try a lower CPU speed (252 or 315 MHz) and see whether the crashes persist? The fault points to an invalid memory access. I will also check PC `0x100069FC` against the matching ELF/map file. Thanks again for testing! |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
1. Which exact UF2 build are you testing? A filename or download link would help. from RC3: https://github.com/DnCraptor/pico-mm/releases/tag/PicoMite-V7.0.00b8-tcc-elf-RC3 filename is PicoMite-PC3.uf2 as it is running on a PC3 2. Does FM crash on A: only, B: only, or both? Does it happen while navigating, selecting a file, or confirming deletion? on both, crashes with every action sometimes. Tried with mark, copy, delete, navigation. Mark (spave key) is the one to go with as it crashes almost certainly somewhere in a list of abt 20 files. Does it on A: and B: 3. Can you reproduce it reliably, or does it happen randomly? completely randomly. But if I mark a list of files on drive A: one by one with the space key it almost certainly can be reproduced. 4. Does it still happen with `OPTION COMPILE OFF` after reboot? yes 5. If possible, could you also try a lower CPU speed (252 or 315 MHz) and see whether the crashes persist? tried with OPTION RESOLUTION 640x480 @ 252000KHz but still crashes. Also tried with WIFI and PSRAM disabled, no success, still crashes. Will try later today on other hardware (Pimoroni Pico plus 2W) in a minimal config to see if this is specific to my PC3 hardware. EDIT: on the Pimoroni FM does not crash but just hangs. Could only try with mark and run as I do only have A: drive there. Hangs randomly on mark and also on run (enter key) for a .bas file. Can only be revived with reset button. Build is PicoMite-WEBRP2350.uf2 in minimum config, no options set, 200MHz. EDIT2: can be reproduced by just starting FM, navigating a few files up and down (cursor keys) and exiting FM with esc -> Hangs. EDIT3: seems not to happen on a genue Pi pico with RP2040 chip (no WiFi) EDIT4: does not happen on plain RP2350 chip either (no WiFi) So after all I suppose it may be connected to the WIFI part even if not in use/not configured. Edited 2026-11-07 19:38 by ville56 73 de OE1HGA, Gerald |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
Thnx. efcbeb5.zip attached contains a fix for stack usage. Pls. try it. efcbeb5.zip |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 665 |
Looks good!!! Tried on RP2350 with Wifi off and on, Telnet console and PSRAM. No issues other than getting double > > > as prompt over telnet. No hangs or crashes anymore. Don't have time now to also test the 2040 build, will be later today. Gerald 73 de OE1HGA, Gerald |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
Thnx a lot. So, it was stack overflow issue. Will provide RC4 today for other platforms. |
||||
| MikeV73 Regular Member Joined: 03/07/2025 Location: UkrainePosts: 42 |
UPD: + RC4: https://github.com/DnCraptor/pico-mm/releases/tag/PicoMite-V7.0.00b8-tcc-elf-RC4 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |