[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Progress on the Thumb2 generator, testing

From: Erlend Sveen
Subject: [Tinycc-devel] Progress on the Thumb2 generator, testing
Date: Sun, 5 Apr 2020 15:19:16 +0000

Hello again.

I have been making some good progress on the Thumb2 code generator. I'm now
on the latest version of TCC, and have almost all of the tests in the
tests2 directory working (excluding those using floats and/or inline asm).

There is one test in particular that I'm struggling with, 97_utf8_string.c.
TCC Seems to think that the string is an integer or something, printing these

tinycc/tests/tests2/97_utf8_string_literal.c:7: warning: assignment makes integer from pointer without a cast
tinycc/tests/tests2/97_utf8_string_literal.c:7: warning: cast between pointer and integer of different size

Compiling with the regular ARM cross compiler makes the same instruction
sequence. If I run the program it only prints the first character. Does anyone
have an idea of what is happening here?


Next question is about testing in general. From what I can tell, it seems like
running the tests only run on the regular x86 version and does not check
anything with the cross compilers. Is this correct? If so, how are the cross
compilers tested? It looks like it only checks that it will compile ex3.c,
and that compiling and running running all the tests requires a target system
to do it on (as in, there is no emulation, check for generation of undefined
instructions/malformed files or other things).

Reason I'm asking is that I'm uncertain about how testing of arm-thumb-tcc fits
into all of this. In order to do my testing, I've made a separate testing
harness. A shell script compiles a list of the relevant tests with TCC and
link them against the C library that I've written. Another script then transfers
all the executables to the target filesystem. I wrote a simple test runner that
uses posix_spawn to run all the tests on the microcontroller and compares the

The OS supports most of the things needed by the tests and does full memory
protection, which makes testing fairly straight forward. Even the grep test
works (although it must be run manually). However the OS is fairly
niche (I've written it), and runs on a microcontroller so the hardware is
fairly specific.

Any thoughts? The testing program could be made to work on Linux with little
modification, so someone might find a use of it, but I'd like to hear some
opinions on how to do this.

Other than this I think it is getting ready for review soon. Hopefully someone
will have time for a quick look. I'll put up a temporary repo somewhere when
the time comes.

Current testing hardware is:
 * stm32f767igt6 with Cortex-M7 @ 216 MHz
 * 8MiB of additional external RAM.
 * 8MiB of external NOR Flash for root filesystem.
 + A bunch of other peripherals

If I'm not mistaken the Thumb2 generator should work with any Cortex-M3, M4 and
M7 microcontrollers but I've not tested those CPUs yet (I have some lying around).

Erlend Sveen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]