Hi lilian just so you know, this email reach me as spam instead of usual
inbox.
Regards

On Wed, May 28, 2025, 11:18 Lilian Besson <lilian.bes...@crans.org> wrote:

> Hello,
>
> Just to let you know, I've worked on this on my own last Saturday, and
> I've almost managed to port TCC to the NumWorks:
> https://github.com/Naereen/A-C-Compiler-for-the-NumWorks-calculator
>
> I've had to modify a bit the source code of tinycc.git/ to build a
> arm-eabihf-libtcc.a static library.
> I wasn't able to build it without modifying the main Makefile, so I did
> that (on my fork, see
>
> https://github.com/Naereen/tinycc/commit/9802ebdebe7c7a8018083517225e8b3d1d193682#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R18-R295
> if someone is curious about the changes).
>
> My embedded version of TCC starts by working well, until it calls on
> tcc_compile_string(tcc_state, code_to_execute)
> See
> https://github.com/Naereen/A-C-Compiler-for-the-NumWorks-calculator/issues/2#issuecomment-2908695111
>
> The error is almost certainly an error on the memory allocation process.
>
> I've tried to use the newlib's realloc() function, or a manually written
> malloc/realloc/free (handling the heap manually, on a static array, just to
> try).
> Both approaches fail when tcc_compile_string(...) starts to ask for some
> larger chunks of heap memory.
>
> It might be because of RAM fragmentation, or simply (sadly) because the
> embedded system of the NumWorks calculator, which has no more than 256K of
> Static RAM.
>
>
> If anyone is interested into a discussion about this project, and mainly
> on how to pinpoint and try to fix this error cause by memory allocation, I
> would gladly discuss over email in English and/or French.
> Many thanks in advance,
>
> Kind regards,
> --
> Lilian Besson,
>   Professor of Computer Science at Lycée Kléber, in Strasbourg (France)
>   web : https://Besson.link/ ; phone : +33628412257
>   email. : lil...@besson.link or lilian.bes...@crans.org
>
>
> Le 24/05/2025 à 11:29, Lilian Besson a écrit :
> > Hello dear developers and maintainers of TCC,
> >
> > I've started to be interested into trying to port the TCC compiler on a
> graphical calculator, the ones manufactured by NumWorks (a French startup).
> >
> > NumWorks calculators use ARM micro-controllers (specifically, STM32
> micro-controllers).
> > As stated by the manufacturer: This chip combines an ARMv7-M Cortex-M7
> core, clocked at 216 MHz and 256K of Static RAM.
> > (see
> https://www.numworks.com/engineering/hardware/electrical/parts/#stm32f730v8t6
> if needed)
> >
> > I'm trying to understand on my own how I need to use TCC's `configure`
> and `make` commands, in order to produce a few files like libtcc.c/libtcc.h.
> > I would like to embed the awesome TCC's "load, compile & run" features,
> in a C application for this NumWorks calculator.
> >
> > I have an app that reads a file locally edited on the calculator, and
> runs it on a Lua interpreter (or JavaScript), and the calculator ships with
> MicroPython already working well.
> > My goal is to offer the same kind of features but for a C program, which
> could be edited on the calculator, read and ran by the "TCC interpreter"
> application.
> >
> > # Here are a few questions:
> >
> >
> > 1. how to use libtcc on an embedded ARM 32bits micro-controller?
> >
> > If I follow the ideas of the libtcc_test.c file (
> https://github.com/Tiny-C-Compiler/tinycc-mirror-repository/blob/mob/tests/libtcc_test.c),
> will it work directly if I cross-compile the resulting C program to my
> ARMv7-M CPU
> > architecture for my NumWorks calculator?
> >
> > I see in the libtcc.c file that there is an option TCC_TARGET_ARM, so I
> should enable it, include libtcc.h and "that's it" ?
> > (
> https://github.com/Tiny-C-Compiler/tinycc-mirror-repository/blob/b6a16e3be4aff2d6b6e4870a1fde5e83707e9be4/libtcc.c#L36C22-L36C22
> )
> >
> >
> > 2. Is there any documentation I can follow, by any chance? Regarding any
> of these questions.
> >
> >
> > 3. Does anybody already tried such a thing, for instance for Texas
> Instrument or Casio calculators?
> >
> > I saw that someone did port the GTC C compiler about 13 years ago, for
> Texas Instrument calculators, but I don't find any other mentions.
> > (here https://tiplanet.org/forum/archives_voir.php?id=1000)
> >
> >
> > Kind regards, and thanks in advance;
>
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to