Help porting newlib to a new CPU architecture (sorta)
Tue Jul 6 14:02:04 GMT 2021
On 2021-07-05 22:35, Mike Frysinger wrote:
> On 06 Jul 2021 02:49, ElijaxApps wrote:
>> I designed a Logisim schematic of a full system, able to run programs in
>> the simulation, as shown in this video:
>> Is based on a SAP-1 (Simplest as Possible) basis, containing 4 GP registers
>> (8 bit), stack for function operations (up to 256 depth levels of
>> recursivity), 24bit plain RAM component, and a simple ALU able to echo
>> strings and perform not floating point math.
>> AFAIK, newlib is suitable for embedded devices, and I want to create the
>> full toolchain for C/C++ language at least.
The full toolchain includes libc, libbfd, binutils, gcc, which would
have to be bootstrapped by cross-compiling from a host system.
There is an AVR target which may support 8b and avr-libc which should
support the toolchain.
There is also an Arduino toolchain based off the AVR toolchain which
supports developing and loading sketches which run on pretty bare 8b MCUs.
You may be better off targeting the latter approach for simplicity.
A lot may depend on how close a match you can find between your target
architecture and some existing architecture.
> i don't know that these would work that well (or at all) on an 8-bit CPU.
> you'd really want a 32-bit CPU nowadays as a minimum if you want to support
> modern software.
> even DOS (iiuc) requires at least a 16-bit CPU. not sure FreeDOS supports
> 16-bit though, or if it too requires 32-bit.
The only current release of DOS is FreeDOS, which supports the 1MB 16b
8088 address space as 64K segments of 16B paragraphs or 16 segments of
64KB, but requires 16b segment CS DS ES SS and general AX BX CX DX SI DI
BP SP registers. FreeDOS supports DOS extenders and toolchains such as
DJGPP to develop and run 32b programs on 32b CPUs.
Even the Small-C compiler in early Dr. Dobb's Magazine issues required
an 8080/Z80 supporting 16b ints.
All the original compilers targeted 12-18b CPUs and required at least
4KW (~8KB), and C used a 16b CPU and supported up to 64KB memory.
Many early compilers for small machines generated threaded code (q.v.)
which saves space when each elementary operation requires multiple
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
More information about the Newlib