Re: [dev] Assembler for bootloader

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
Date: Tue, 10 Jun 2025 14:06:35 +0200

Hi,

On Tue, Jun 10, 2025 at 03:43:41PM +0530, Sagar Acharya wrote:
> scc is amazing, like all other compiler recommendations from suckless.

Thank you!

>
> Can you help with making a linear RV32I code from C code? I think it should be very similar to arm. Currently, jump instructions have different notation in ganyantra like loop is not detected, etc.
>

Due to the collaboration between scc and qbe, the arm64, amd64 and riscv64 ports
are implemented using qbe, that does all the instruction selection work.
Sadly, qbe has strong design decisions tied to 64 bit architecturesthat make
hard (in the current state) to create ports for 32 bits (or my main interest,
z80, a 8 bit processor xD).

What is easy in scc is to implment the riscv32 assembler. I have code to support
coff32 and I cover elf partially (in fact, I have pending patches for elf in
my local workcopy, but I have to finish the wchar.h work before continuing with
elf).

> I am unable to understand how linking and loading happens as they seem board specific.

If you need help, I can help you with it. For me, the best doc to understand linkers
and loading process was "Linkers and loaders". You can find a early version of it in
[1], but I recomend you to buy it.


> Update: bitgen.sh can now help with generating a final binary file that is to be written on flash. Fixed minor bugs.

Nice! The problem with assemblers come when you take in consideration
relocations, and then you have to go with binary formats and it increases
the complexity a lot.

Just send me a email if you need some help to understand these topics.

Regards,

[1] http://www.staroceans.org/e-book/LinkersAndLoaders.pdf
Received on Tue Jun 10 2025 - 14:06:35 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 10 2025 - 14:12:10 CEST