From e66dcfb595216de1671615e6cb6bd84aaa9217ab Mon Sep 17 00:00:00 2001 From: Robert Clausecker Date: Sat, 10 Apr 2021 13:27:05 +0000 Subject: [PATCH] lang/mecrisp-stellaris: fix build problems Fix the build issue by building with arm-none-eabi-binutils as meant by the authors. Add support for building on Aarch64 for FreeBSD >= 13. Patch incorrect icache synchronisation; a more comprehensive patch is slated for inclusion into mecrisp-stellaris 2.5.9. --- lang/mecrisp-stellaris/Makefile | 29 ++++++++++--------- ...isp-stellaris-source_freebsd-ra_terminal.s | 25 ++++++++++++++++ lang/mecrisp-stellaris/pkg-message | 8 +++++ 3 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 lang/mecrisp-stellaris/files/patch-mecrisp-stellaris-source_freebsd-ra_terminal.s create mode 100644 lang/mecrisp-stellaris/pkg-message diff --git a/lang/mecrisp-stellaris/Makefile b/lang/mecrisp-stellaris/Makefile index bb53237c3390..fb5383be14b9 100644 --- a/lang/mecrisp-stellaris/Makefile +++ b/lang/mecrisp-stellaris/Makefile @@ -1,5 +1,6 @@ PORTNAME= mecrisp-stellaris DISTVERSION= 2.5.8 +PORTREVISION= 1 CATEGORIES= lang MASTER_SITES= SF/mecrisp @@ -9,10 +10,22 @@ COMMENT= Native code Forth system for ARM LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING +OPTIONS_DEFINE= EXTRAS +OPTIONS_DEFAULT= EXTRAS +EXTRAS_DESC= Add disassembler and math library to Forth core +EXTRAS_VARS= PROGRAM=mecrisp-stellaris-freebsd-with-disassembler-and-math +EXTRAS_VARS_OFF= PROGRAM=mecrisp-stellaris-freebsd + +.include + +.if ${OSVERSION} < 1300000 ONLY_FOR_ARCHS= armv6 armv7 +.else +ONLY_FOR_ARCHS= armv6 armv7 aarch64 +.endif ONLY_FOR_ARCHS_REASON= written in ARM assembly -BUILD_DEPENDS= binutils>2.33:devel/binutils +BUILD_DEPENDS= arm-none-eabi-binutils>2.25:devel/binutils@arm_none_eabi AFLAGS.armv6= -march=armv6 --defsym m0core=1 MAKE_ENV+= AFLAGS="${AFLAGS.${ARCH}}" @@ -20,18 +33,6 @@ MAKE_ENV+= AFLAGS="${AFLAGS.${ARCH}}" # stripping eats our hand-crafted ELF binaries, so don't do that # the binaries are free of symbols or stuff like that anyway STRIP= -# definitions assuming we build on ARM -BINARY_ALIAS= arm-none-eabi-as=${LOCALBASE}/bin/${AS} \ - arm-none-eabi-ld=${LOCALBASE}/bin/${LD} \ - arm-none-eabi-objcopy=${LOCALBASE}/bin/${OBJCOPY} - -OPTIONS_DEFINE= EXTRAS -OPTIONS_DEFAULT= EXTRAS -EXTRAS_DESC= Add disassembler and math library to Forth core -EXTRAS_VARS= PROGRAM=mecrisp-stellaris-freebsd-with-disassembler-and-math -EXTRAS_VARS_OFF= PROGRAM=mecrisp-stellaris-freebsd - -.include # Can't use the release script as it tries to build a bunch of stuff # that won't build correctly. This does the relevant parts manually. @@ -47,4 +48,4 @@ do-install: cd ${WRKSRC}/common; ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR} ${INSTALL_PROGRAM} ${WRKSRC}/freebsd-ra/${PROGRAM} ${STAGEDIR}${PREFIX}/bin/mecrisp-stellaris -.include +.include diff --git a/lang/mecrisp-stellaris/files/patch-mecrisp-stellaris-source_freebsd-ra_terminal.s b/lang/mecrisp-stellaris/files/patch-mecrisp-stellaris-source_freebsd-ra_terminal.s new file mode 100644 index 000000000000..9aecba07f8bb --- /dev/null +++ b/lang/mecrisp-stellaris/files/patch-mecrisp-stellaris-source_freebsd-ra_terminal.s @@ -0,0 +1,25 @@ +--- mecrisp-stellaris-source/freebsd-ra/terminal.s.orig 2021-04-10 12:49:15 UTC ++++ mecrisp-stellaris-source/freebsd-ra/terminal.s +@@ -167,7 +167,6 @@ serial_key: @ ( -- c ) Receive one character + cacheflush: + @ ----------------------------------------------------------------------------- + +-.ifdef m0core + @ ARMv6 hat keine Speicherbarrieren. Das muss über einen syscall realisiert werden + push {r4-r7, lr} + movs r0, #0 @ ARM_SYNC_ICACHE +@@ -180,14 +179,6 @@ cacheflush: + @ Datenstruktur arm_sync_icache_args für den sysarch-Aufruf + 0:.word incipit + .word totalsize +- +-.else +- @ auf ARMv7 und später nehmen wir einfach die Barrien-Befehle +- dmb +- dsb +- isb +- bx lr +-.endif + + @ ----------------------------------------------------------------------------- + Wortbirne Flag_foldable_0, "arguments" @ ( -- a-addr ) diff --git a/lang/mecrisp-stellaris/pkg-message b/lang/mecrisp-stellaris/pkg-message new file mode 100644 index 000000000000..bbf2f9f716c8 --- /dev/null +++ b/lang/mecrisp-stellaris/pkg-message @@ -0,0 +1,8 @@ +This port is written in ARM32 assembly. On ARM64 systems, it only runs +on those that support the AArch32 execution state in EL0. If the port +does not run, check dmesg for a line like + + Processor Features 0 = + +If the feature string "EL0 32" does not occur, your processor cannot +run ARM32 binaries and thus will not be able to run this port either. -- 2.30.1