Help porting newlib to a new CPU architecture (sorta)
Tue Jul 6 00:49:05 GMT 2021
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.
At first I tried porting it by my own using this guide:
And I am stuck here:
Implement the Board Support Package(s) for the target (Chapter 5
Implement the C Runtime start up, crt0.o for each BSP (Section 5.2
Implement the environment global variable and 18 system call
functions for each BSP following the convention namespace and
reentrancy conventions specified in newlib/configure.host (Section 5.3
and Section 5.4
Create libgloss/*target*/Makefile.in and libgloss/*target*/
configure.ac, based on the versions in the libgloss/libnosys directory
and run aclocal and autoconf in libgloss/*target* (Section 5.5
I have some questions regarding those points:
1) ATM my system is programmable, using a kind of own pseudo-assembler code
I created for that purpose, alongside with a Java compiler which translates
it to text hex file, then I copy its contents to the simulation's RAM. But
it's not "normal", "standard" ASSY, just an approximation made by not an
assy guy... (never coded any in actual ASSY).
- How do I write CRT code? In standard ASSY? In my own assy, and somewhere
I tell which binary format represents each mnemonic? In case of the first,
how will the toolchain know the opcodes and binary format of the
instructions and data? In case of the second, could you please clarify the
paths of those files in the docs? :)
The full source to Libre 8 CPU is here. Some recent changes are not yet
pushed but the commited and de documentation provided in github should be
enough to make you an idea of what I tell by pseudo-assy.
I want to push it further, and perhaps port some existing software to it as
FreeDOS ... , as far as I can get. All ideas are welcome.
If you have to make questions about the architecture don't hesitate and do
it. If I have to modify os made changes to fit any requirement it won't be
a problem, even now I've reached this far.
I hope this is possible. Thank you,
More information about the Newlib