Dman95 / SASM

SASM - simple crossplatform IDE for NASM, MASM, GAS and FASM assembly languages

Home Page:http://dman95.github.io/SASM/

Repository from Github https://github.comDman95/SASMRepository from Github https://github.comDman95/SASM

Attempting to compile and link very simple code on a Raspberry Pi 400

SirClickALot opened this issue · comments

I have been looking for the 'right' tools for introducing ARM assembly language to absolute beginners on a Raspberry Pi and it seems to me that SASM fits the bill better than anything else I can find - this is brilliant simple and I'm hoping that it will enable me to enthuse some students who are seriously put off by using the CLI. Great work Team, really great!

The Raspberry Pi comes with GNU 'as' - GAS configured a working fine for the ARM Cortex-A72 as can be seen here when questioned in the Terminal...

$ as --version
GNU assembler (GNU Binutils for Raspbian) 2.35.2
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-linux-gnueabihf'

I am trying to set up SASM so that I can edit simple code and 'compile' and 'run' directly within the SAM UI.

My code does nothing except for stick a value on register R0 then exits.

Here is my (very!) simple example code stored in the file named 'prog3.s' ...

.global  _start

_start:
	MOV R0, #65
	MOV R7, #1
	SVC 0

I have that file in a directory called 'Assembler' and my Terminal session is sitting in that directory.

Using the Terminal, I can compile and link as expected...

ls
prog3a.s
as -o prog3a.o prog3a.s
ls
as -o prog3a.o prog3a.s
ld -o prog3 prog3a.o
ls
prog3  prog3a.o  prog3a.s
./prog3
echo $s
65

^^^ The above executable runs without issue.

So, in summary, I seem to be able to be able to edit/compile/link and run ARM Cortex-A72 (64 bit)

HOWEVER,when I try to Build and Run from within the SASM UI, I cannot and get the following message...

/usr/bin/as: unrecognized option '--64' gcc: error: /tmp/SASM/program.o: No such file or directory gcc: error: /tmp/SASM/macro.o: No such file or directory gcc: error: unrecognized command-line option '-m64' gcc: fatal error: no input files compilation terminated.

I have tried the 32bit settings and I ave tried multiple other 'suggestions' that SASM reports back to me such as 'did you mean '-mbe32'? but nothing seems to work?

Also, if it helps at this point, if I try to invoke GCC in the Terminal in one hit with...

gcc prog3a.s

I get...

/usr/bin/ld: /tmp/cchqVFgX.o: in function `_start':
(.text+0x0): multiple definition of `_start'; /usr/lib/gcc/arm-linux-gnueabihf/10/../../../arm-linux-gnueabihf/crt1.o:(.text+0x0): first defined here
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/10/../../../arm-linux-gnueabihf/crt1.o: in function `_start':
(.text+0x34): undefined reference to `main'
collect2: error: ld returned 1 exit status

Whatever all that means!?

As far as I'm concerned after a couple of days of trying out various GUI-drive assemblers, your SASM offering is BY FAR the best option for teaching basic assembler but I just cannot get it going :-(

Can anyone please help here?

My SASM Build settings are as follows (screenshot)...

screenshot

Thanks

Nick

You can read the "Building system settings" section in the SASM help and just manually fix the assembler, linker and their options according to your needs.

Thanks @Dman95,
For anyone else trying to get this going on a Raspberry Pi, the follow settings...
SCREENSHOT