Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARMv6h cross-compilation #85

Closed
Fubukimaru opened this issue Jan 27, 2021 · 6 comments · Fixed by #86
Closed

Add ARMv6h cross-compilation #85

Fubukimaru opened this issue Jan 27, 2021 · 6 comments · Fixed by #86
Assignees

Comments

@Fubukimaru
Copy link
Owner

Probably asMSX will be included in the very beautiful MSXVR which is based on a Raspberry Pi board. Therefore we need to have a release cross-compilation for this architecture.

@Fubukimaru Fubukimaru self-assigned this Jan 27, 2021
@Fubukimaru
Copy link
Owner Author

@duhow
Copy link
Collaborator

duhow commented Jan 28, 2021

Do you mean it is able to run Linux ELF armel programs?
You can implement this build generation in Github Actions to make it universal :)

@Fubukimaru
Copy link
Owner Author

So, github is able to generate it directly? It would be cool that Github would build the release zips when a release is defined. Is this possible?

I'm now trying to add arm-linux-gnueabihf-gcc building step.

@duhow
Copy link
Collaborator

duhow commented Jan 28, 2021

Rather than defining a new "step", you should be able to change CC and FLAGS by calling them in the make command or via environment. That's how the cross-compile projects are done.

diff --git a/Makefile b/Makefile
index f59ea16..05e540c 100644
--- a/Makefile
+++ b/Makefile
@@ -75,7 +75,7 @@ src/%.o: src/%.c
 asmsx.osx: CC := $(CC_OSX)
 asmsx.exe: CC := $(CC_WIN)
 asmsx asmsx.osx asmsx.exe: $(ALL_FILES) $(HEADERS)
-       $(CC) $(ALL_FILES) -o$@ $(OPT)
+       $(CC) $(ALL_FILES) -o$@ $(OPT) $(LDFLAGS)
 
 asmsx-debug: $(ALL_FILES) $(HEADERS) src/dura.y src/lex.l
        $(CC) -ggdb $(ALL_FILES) -o$@ $(OPT_DEBUG)
root@predator:/asMSX# make CC=gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc LDFLAGS="-specs=nosys.specs"
gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc src/dura.tab.c src/lex.yy.c src/lex.parser1.c src/lex.parser2.c src/lex.parser3.c src/lex.parser4.c src/asmsx.c src/labels.c -oasmsx -lm -O2 -Os -s -Wall -Wextra -DVERSION=\"1.0.0-39-g0eb102d\" -DDATE=\"2021-01-20\" -DLINUX -specs=nosys.specs

root@predator:/asMSX# ls -la
total 348
drwxr-xr-x 10 root root   4096 Jan 28 17:46 .
drwxr-xr-x  1 root root   4096 Jan 28 17:32 ..
drwxr-xr-x  8 root root   4096 Jan 28 17:46 .git
-rw-r--r--  1 root root    103 Jan 28 17:32 .gitattributes
drwxr-xr-x  3 root root   4096 Jan 28 17:32 .github
-rw-r--r--  1 root root    488 Jan 28 17:32 .gitignore
-rw-r--r--  1 root root   5370 Jan 28 17:32 CHANGELOG.md
-rw-r--r--  1 root root  35796 Jan 28 17:32 LICENSE.md
-rw-r--r--  1 root root   2586 Jan 28 17:38 Makefile
-rw-r--r--  1 root root   1871 Jan 28 17:32 README.md
-rwxr-xr-x  1 root root 282608 Jan 28 17:46 asmsx
drwxr-xr-x  3 root root   4096 Jan 28 17:32 build
drwxr-xr-x  3 root root   4096 Jan 28 17:32 code
drwxr-xr-x  2 root root   4096 Jan 28 17:32 doc
drwxr-xr-x  6 root root   4096 Jan 28 17:33 gcc-arm-none-eabi-10-2020-q4-major
drwxr-xr-x  2 root root   4096 Jan 28 17:32 ref
drwxr-xr-x  2 root root   4096 Jan 28 17:35 src

root@predator:/asMSX# file asmsx 
asmsx: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

And yes, release can be generated from Github Actions.

@Fubukimaru
Copy link
Owner Author

Cool! Two things:

Instead of none could we use linux? I learned today that none is to compile bare metal executables.

And, I would like to generate a new asmsx.arm or something like that, so that the make release build both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants