-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚨🔊 Add a better Data Abort Handler (#112)
* Add WIP of a better DataAbortHandler * More WIP * Cleanup * refactor some things * Refactor, clean up, and documentation * More comments * Update unwind.c * Tweak printfs * Add custom build of newlib * Include libc/libm in template * Exclude libc/libm from being included in cold image * check whether pc is in the hot zone * test unwind with hot/cold linking * Add support for unwinding through hot code * Clean up for PR * Undo USE_PACKAGE:=1 * remove leftover include * move __env_lock/__env_unlock to src/system/envlock.c missed this in #155, but these two functions are moved to their own file for the same reason as __malloc_lock/__malloc_unlock were-- to follow the override scheme that newlib expects. found the right filename from here: https://newlib.sourceware.narkive.com/aXWplROp/queries-concerning-rtos-protection-in-newllib * lint files * Update .arclint whitespace
- Loading branch information
1 parent
4a00c5e
commit 6394b23
Showing
20 changed files
with
476 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
############################################################################### | ||
# | ||
# This pipeline builds newlib with the same flags as the official toolchain, | ||
# but adds -funwind-tables so we can have proper unwind info inside libc | ||
# | ||
############################################################################### | ||
variables: | ||
source_url: 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-src.tar.bz2' | ||
source_directory: 'gcc-arm-none-eabi-8-2018-q4-major' | ||
|
||
jobs: | ||
- job: BuildLibc | ||
pool: | ||
vmImage: 'ubuntu-16.04' | ||
timeoutInMinutes: 0 | ||
steps: | ||
- bash: | | ||
sudo apt-get install software-properties-common | ||
sudo dpkg --add-architecture i386 | ||
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa | ||
sudo apt-get update | ||
sudo apt-get install build-essential autoconf autogen bison dejagnu flex flip gawk git gperf gzip \ | ||
nsis openssh-client p7zip-full perl python-dev libisl-dev scons tcl tofrodos \ | ||
wget libncurses5-dev pv | ||
sudo apt-get install gcc-arm-embedded | ||
displayName: Install apt packages | ||
- bash: | | ||
curl -L $(source_url) -o $(source_directory).tar.bz2 | ||
pv -f $(source_directory).tar.bz2 | tar -xjf - | ||
displayName: Download/extract arm-none-eabi-gcc source | ||
- bash: | | ||
sed -i '95s/TERM|\\/TERM|agent.jobstatus|\\/' ./build-common.sh | ||
sed -i '302s/http:\/\/www.mr511.de\/software\//https:\/\/github.com\/gnu-mcu-eclipse\/files\/raw\/master\/libs\//' ./build-common.sh | ||
displayName: Edit ./build-common.sh | ||
workingDirectory: $(source_directory) | ||
- bash: | | ||
sed -i "294s/.*/saveenvvar CFLAGS_FOR_TARGET '-g -O2 -ffunction-sections -fdata-sections -funwind-tables'/" ./build-toolchain.sh | ||
head -n 316 ./build-toolchain.sh > ./build-toolchain.sh | ||
displayName: Edit ./build-toolchain.sh | ||
workingDirectory: $(source_directory) | ||
- bash: | | ||
./install-sources.sh --skip_steps=mingw32 | ||
displayName: Install sources | ||
workingDirectory: $(source_directory) | ||
- bash: | | ||
./build-prerequisites.sh --skip_steps=mingw32 | ||
displayName: Build prerequisites | ||
workingDirectory: $(source_directory) | ||
- bash: | | ||
export CFLAGS_FOR_TARGET='-g -O2 -ffunction-sections -fdata-sections -funwind-tables' | ||
export ROOT=`pwd` | ||
mkdir -p $ROOT/build-native/newlib | ||
pushd $ROOT/build-native/newlib | ||
$ROOT/src/newlib/configure \ | ||
--build="`uname -m | sed 'y/XI/xi/'`"-linux-gnu --host="`uname -m | sed 'y/XI/xi/'`"-linux-gnu \ | ||
--target=arm-none-eabi \ | ||
--prefix=$ROOT/newlib \ | ||
--enable-newlib-io-long-long \ | ||
--enable-newlib-io-c99-formats \ | ||
--enable-newlib-register-fini \ | ||
--enable-newlib-retargetable-locking \ | ||
--disable-newlib-supplied-syscalls \ | ||
--disable-nls \ | ||
make -j`grep ^processor /proc/cpuinfo|wc -l` | ||
make install | ||
ls -R $ROOT/newlib | ||
ls -R $ROOT/build-native/newlib | ||
cp $ROOT/newlib/arm-none-eabi/lib/thumb/v7-ar/libc.a $(Build.ArtifactStagingDirectory) | ||
cp $ROOT/newlib/arm-none-eabi/lib/thumb/v7-ar/libm.a $(Build.ArtifactStagingDirectory) | ||
ls $(Build.ArtifactStagingDirectory) | ||
TARGET_LIBRARIES=`find $(Build.ArtifactStagingDirectory) -name \*.a` | ||
for target_lib in $TARGET_LIBRARIES ; do | ||
echo Stripping $target_lib | ||
arm-none-eabi-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc $target_lib || true | ||
done | ||
displayName: Build toolchain | ||
workingDirectory: $(source_directory) | ||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: 'newlib' | ||
targetPath: $(Build.ArtifactStagingDirectory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */ | ||
|
||
start_of_cold_mem = 0x03800000; | ||
_COLD_MEM_SIZE = 0x04800000; | ||
end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE; | ||
|
||
start_of_hot_mem = 0x07800000; | ||
_HOT_MEM_SIZE = 0x00800000; | ||
end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE; | ||
|
||
MEMORY | ||
{ | ||
/* user code 72M */ | ||
COLD_MEMORY : ORIGIN = 0x03800000, LENGTH = 0x04800000 /* Just under 19 MB */ | ||
COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */ | ||
HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE | ||
HOT_MEMORY : ORIGIN = 0x07800000, LENGTH = 0x00800000 /* Just over 8 MB */ | ||
HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* \file system/envlock.c | ||
* | ||
* environment lock newlib stubs | ||
* | ||
* Contains implementations of environment-locking functions for newlib. | ||
* | ||
* Copyright (c) 2017-2019, Purdue University ACM SIGBots. | ||
* All rights reserved. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#include "rtos/task.h" | ||
|
||
void __env_lock(void) { | ||
rtos_suspend_all(); | ||
} | ||
|
||
void __env_unlock(void) { | ||
rtos_resume_all(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.