|
From: | Erlend Sveen |
Subject: | Re: [Tinycc-devel] Thumb2 codegen ready for review |
Date: | Sat, 23 May 2020 16:53:26 +0000 |
Hi, some answers:
- How this work will be supported, I mean who (you?) will actively maintain this port so that this backend is fully synchronized and working when mob changes.
I intend to keep an eye on the mailing list and keep it working, yes. Especially since I have good hardware for running it. One of my other projects is automatic testing with real hardware, hopefully I can get somewhere with that to make this easy.
- How can we test it? (from RPi would be nice, using a VM with emulator).
As I wrote, RPi would probably need the thumb interwork. This is one of the remaining things that I'm not certain about how to implement. Without it, Thumb2 code cannot call into ARM code reliably which I expect to be common on RPi. I'm guessing this is
mostly a linker job that requires some correct metadata of sorts so that it does the right thing.
If there is an emulator for Cortex-M that would probably work too, but I do not know much about these. If anyone knows a good one for MCUs I'd love to know.
I currently test it on real hardware, STM32F767IGT6 is the device model, but this is somewhat custom regarding peripherals. I'm currently working on getting it to run nicely on more "off the shelf" hardware (the STM32 discovery kits) bit this is kind of
the nature of embedded MCU stuff (lots of products of all types, often non-trivial to get started with). The world of ARM based MCUs is of course huge, but the amount of users of this TCC version will probably be much smaller than for RPi or x86 so hopefully
we can get it working on the RPi. This is really a niche within a niche!
I also run my own OS on the thing which makes it easy to automate some tasks, among other things. The new backend can of course be used in a "normal" fashion too, that is, bare metal development like you would use gcc-arm-none-eabi toolchain. Which is
actually how I've been using it most of the time.
Maybe. I hope to get that working but I do not know how much work this is since I have not looked into it. TCC for linking would be very nice since GNU LD is extremely slow when running on my target.
Regards,
Erlend.
Fra: Tinycc-devel <tinycc-devel-bounces+erlend.sveen=address@hidden> på vegne av Christian Jullien <address@hidden>
Sendt: lørdag 23. mai 2020 15:06 Til: address@hidden <address@hidden> Emne: Re: [Tinycc-devel] Thumb2 codegen ready for review Hi, this is really cool to have a new backend for tcc. Congrat!!
I had a quick look on you repository but I’m not qualified to comment it. FYI the few last weeks I made a POC with a friend of mine to add z80 backend which generates .asm files. It is far from working but I’ve made similar changes.
I have more general questions: - How this work will be supported, I mean who (you?) will actively maintain this port so that this backend is fully synchronized and working when mob changes. - How can we test it? (from RPi would be nice, using a VM with emulator). - Do you plan to support tcc linking instead of ld? It would be a nice addition if you can.
My concern is that I don’t want to see a new backend that nobody will use or maintain in the next months/years.
C.
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=address@hidden]
On Behalf Of Erlend Sveen
Hi, It's been a while now since I've been working on and off various projects for the last few months, but I finally think my TCC additions are ready for a second pair of eyes (and more). I hope you have some time to look at it before I try getting it into the "real" repo.
Initially I wrote that I would not implement any floating point stuff, but after looking over the instruction set I found that it was way easier than I expected. I also got TCC to run on the microcontroller itself, which also took a fair bit of time. I think this is quite cool, lots of stories about people running Linux on their micros but not as many about compilers as far as I can tell! In fact I've found no articles at all after some minutes of searching. People have done interpreters but I could not find anything for C.
Since I don't want to break the main repo I've put up a temporary one before I try committing anything to the mob branch. I hoped to make it in one commit but ended up with multiple, so here is an explanation of them and links:
https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d
- This adds the most of the code, please see the commit message for an explanation. The most important bits are of course changes to existing files.
https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f
- Once I started compiling "real" code I found some bugs, this fixes some.
https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154
- Adds float support back in and a new test, please see the commit message. It also cleans up a bunch of stuff, fixes some bugs and adds another test to trigger more branches.
At this point there are some things left that I have not figured out yet. I hope maybe someone can help a bit with these, either by code or feedback on how to do things:
* Interwork between ARM state and Thumb state. Probably required to get it working on a Raspberry Pi. But not required for MCU use. * The linker in TCC does not seem to work, so I've used the GNU one. * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of which FPU ISA it uses. I expect that the current code will cause some troble linking with elf files that specify e.g. no FPU despite not actually having generated any FPU instructions. * Using floats requires a Cortex-M7 with double precision, since there are no fallbacks to the library routines. Could be fixed if the previous point is implemented. * There is a branch in the store function that I could not figure out how to test, so it remains unimplemented. It is for vmov i think. * log10 gets the sign wrong and I have no idea why.
So far I've only tested using a Cortex-M7. M3 and M4 should work for integer code but I have not gotten around to testing that yet.
There are also plenty of files that I figured does not belong in the TCC repository. It mostly contains build scripts, test harness code, various notes and so on. For an overview of how testing is going, check "tcc-hacking.ods" here:
https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
Anyways, I think my code is ready now. It successfully compiles all my projects that I have tried compiling, and they run properly although much slower.
Regards, Erlend Sveen |
[Prev in Thread] | Current Thread | [Next in Thread] |