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

make: use pre-compiled newlib and libc++ #353

Merged
merged 18 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 9 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
ci-format:
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split this PR up more? A few of these changes could just go right in which would reduce the diff and make reverting any regressions easier

# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

Expand All @@ -21,37 +21,18 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: false # LVGL makefile manually installs the submodule
- uses: fiam/arm-none-eabi-gcc@v1
- uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10-2020-q4' # The arm-none-eabi-gcc release to use.
release: '10.3-2021.07' # The arm-none-eabi-gcc release to use.
- name: setup-riscv-toolchain
run: |
RISCV_TOOLCHAIN_MIRRORS=(\
"http://www.cs.virginia.edu/~bjc8c/archive/gcc-riscv64-unknown-elf-8.3.0-ubuntu.zip" \
"https://alpha.mirror.svc.schuermann.io/files/2023-08-17_gcc-riscv64-unknown-elf-8.3.0-ubuntu.zip"\
)
pushd $HOME
for MIRROR in ${RISCV_TOOLCHAIN_MIRRORS[@]}; do
echo "Fetching RISC-V toolchain from ${MIRROR}..."
wget -Oriscv-toolchain.zip -q "$MIRROR" &&\
(echo "2c82a8f3ac77bf2b24d66abff3aa5e873750c76de24c77e12dae91b9d2f4da27 riscv-toolchain.zip" |\
sha256sum -c)
if [ $? -ne 0 ]; then
echo "WARNING: Fetching RISC-V from mirror $MIRROR failed!" >&2
else
break
fi
done
unzip riscv-toolchain.zip
echo "$HOME/gcc-riscv64-unknown-elf-8.3.0-ubuntu/bin" >> $GITHUB_PATH
popd
run: sudo apt-get install -y gcc-riscv64-unknown-elf
- name: ci-format
run: pushd examples; ./format_all.sh || exit; popd

ci-build:
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

Expand All @@ -60,31 +41,12 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: fiam/arm-none-eabi-gcc@v1
- uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10-2020-q4' # The arm-none-eabi-gcc release to use.
release: '10.3-2021.07' # The arm-none-eabi-gcc release to use.
- name: setup-riscv-toolchain
run: |
RISCV_TOOLCHAIN_MIRRORS=(\
"http://www.cs.virginia.edu/~bjc8c/archive/gcc-riscv64-unknown-elf-8.3.0-ubuntu.zip" \
"https://alpha.mirror.svc.schuermann.io/files/2023-08-17_gcc-riscv64-unknown-elf-8.3.0-ubuntu.zip"\
)
pushd $HOME
for MIRROR in ${RISCV_TOOLCHAIN_MIRRORS[@]}; do
echo "Fetching RISC-V toolchain from ${MIRROR}..."
wget -Oriscv-toolchain.zip -q "$MIRROR" &&\
(echo "2c82a8f3ac77bf2b24d66abff3aa5e873750c76de24c77e12dae91b9d2f4da27 riscv-toolchain.zip" |\
sha256sum -c)
if [ $? -ne 0 ]; then
echo "WARNING: Fetching RISC-V from mirror $MIRROR failed!" >&2
else
break
fi
done
unzip riscv-toolchain.zip
echo "$HOME/gcc-riscv64-unknown-elf-8.3.0-ubuntu/bin" >> $GITHUB_PATH
popd
run: sudo apt-get install -y gcc-riscv64-unknown-elf
- name: ci-build
run: pushd examples; RISCV=1 ./build_all.sh || exit; popd
run: pushd examples; ./build_all.sh || exit; popd
- name: ci-debug-build
run: pushd examples/blink; make debug RAM_START=0x20004000 FLASH_INIT=0x30051 || exit; popd
13 changes: 8 additions & 5 deletions AppMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ include $(TOCK_USERLAND_BASE_DIR)/Configuration.mk
# Helper functions.
include $(TOCK_USERLAND_BASE_DIR)/Helpers.mk

# Targets for fetching pre-compiled libraries.
include $(TOCK_USERLAND_BASE_DIR)/Precompiled.mk

# Include the libtock makefile. Adds rules that will rebuild the core libtock
# library when needed.
include $(TOCK_USERLAND_BASE_DIR)/libtock/Makefile
Expand Down Expand Up @@ -106,7 +109,7 @@ $$(BUILDDIR)/$(1):

# First step doesn't actually compile, just generate header dependency information
# More info on our approach here: http://stackoverflow.com/questions/97338
$$(BUILDDIR)/$(1)/%.o: %.c | $$(BUILDDIR)/$(1)
$$(BUILDDIR)/$(1)/%.o: %.c | $$(BUILDDIR)/$(1) newlib-$$(NEWLIB_VERSION_$(1))
$$(TRACE_CC)
$$(Q)$$(TOOLCHAIN_$(1))$$(CC_$(1)) $$(CFLAGS) $$(CFLAGS_$(1)) $$(CPPFLAGS) $$(CPPFLAGS_$(1)) -MF"$$(@:.o=.d)" -MG -MM -MP -MT"$$(@:.o=.d)@" -MT"$$@" "$$<"
$$(Q)$$(TOOLCHAIN_$(1))$$(CC_$(1)) $$(CFLAGS) $$(CFLAGS_$(1)) $$(CPPFLAGS) $$(CPPFLAGS_$(1)) -c -o $$@ $$<
Expand Down Expand Up @@ -157,15 +160,15 @@ $$(BUILDDIR)/$(1)/$(2).custom.ld: $$(LAYOUT) | $$(BUILDDIR)/$(1)
perl -pi -e "s/(SRAM.*ORIGIN[ =]*)([x0-9]*)(,.*LENGTH)/\$$$${1}$(4)\$$$$3/" $$@

# Collect all desired built output.
$$(BUILDDIR)/$(1)/$(2).elf: $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LEGACY_LIBS_$(1)) $$(BUILDDIR)/$(1)/$(2).custom.ld | $$(BUILDDIR)/$(1)
$$(BUILDDIR)/$(1)/$(2).elf: $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LINK_LIBS_$(1)) $$(BUILDDIR)/$(1)/$(2).custom.ld | $$(BUILDDIR)/$(1)
$$(TRACE_LD)
$$(Q)$$(TOOLCHAIN_$(1))$$(CC_$(1)) $$(CFLAGS) $$(CFLAGS_$(1)) $$(CPPFLAGS) $$(CPPFLAGS_$(1)) $$(WLFLAGS) $$(WLFLAGS_$(1))\
-Xlinker --defsym=STACK_SIZE=$$(STACK_SIZE)\
-Xlinker --defsym=APP_HEAP_SIZE=$$(APP_HEAP_SIZE)\
-Xlinker --defsym=KERNEL_HEAP_SIZE=$$(KERNEL_HEAP_SIZE)\
-T $$(BUILDDIR)/$(1)/$(2).custom.ld\
-nostdlib\
-Wl,--start-group $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LEGACY_LIBS_$(1)) $$(LINK_LIBS_$(1)) -Wl,--end-group\
-Wl,--start-group $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LINK_LIBS_$(1)) -Wl,--end-group\
-Wl,-Map=$$(BUILDDIR)/$(1)/$(2).Map\
-o $$@

Expand Down Expand Up @@ -244,15 +247,15 @@ else
endif

# Step 2: Create a new ELF with the layout that matches what's loaded
$$(BUILDDIR)/$(1)/$(2).userland_debug.elf: $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LEGACY_LIBS_$(1)) $$(BUILDDIR)/$(1)/$(2).userland_debug.ld | $$(BUILDDIR)/$(1)
$$(BUILDDIR)/$(1)/$(2).userland_debug.elf: $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LINK_LIBS_$(1)) $$(BUILDDIR)/$(1)/$(2).userland_debug.ld | $$(BUILDDIR)/$(1)
$$(TRACE_LD)
$$(Q)$$(TOOLCHAIN_$(1))$$(CC_$(1)) $$(CFLAGS) $$(CFLAGS_$(1)) $$(CPPFLAGS) $$(CPPFLAGS_$(1)) $$(WLFLAGS) $$(WLFLAGS_$(1))\
-Xlinker --defsym=STACK_SIZE=$$(STACK_SIZE)\
-Xlinker --defsym=APP_HEAP_SIZE=$$(APP_HEAP_SIZE)\
-Xlinker --defsym=KERNEL_HEAP_SIZE=$$(KERNEL_HEAP_SIZE)\
-T $$(BUILDDIR)/$(1)/$(2).userland_debug.ld\
-nostdlib\
-Wl,--start-group $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LEGACY_LIBS_$(1)) $$(LINK_LIBS_$(1)) -Wl,--end-group\
-Wl,--start-group $$(OBJS_$(1)) $$(LIBS_$(1)) $$(LINK_LIBS_$(1)) -Wl,--end-group\
-Wl,-Map=$$(BUILDDIR)/$(1)/$(2).Map\
-o $$@

Expand Down
Loading
Loading