diff --git a/.github/workflows/0.0.2.yml b/.github/workflows/0.0.2.yml new file mode 100644 index 0000000..bd94f30 --- /dev/null +++ b/.github/workflows/0.0.2.yml @@ -0,0 +1,11 @@ +name: 🚀 Deploy 0.0.2 + +on: + workflow_dispatch: + +jobs: + deploy: + uses: libhal/ci/.github/workflows/deploy_all.yml@5.x.y + with: + version: 0.0.2 + secrets: inherit diff --git a/conanfile.py b/conanfile.py index 54ab64e..4d3761c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -13,7 +13,7 @@ # limitations under the License. from conan import ConanFile -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout from conan.tools.files import copy from conan.tools.build import check_min_cppstd from conan.errors import ConanInvalidConfiguration diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt deleted file mode 100644 index 10cd58a..0000000 --- a/demos/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2024 Khalil Estell -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cmake_minimum_required(VERSION 3.20) - -project(demos LANGUAGES CXX) - -set(platform_library $ENV{LIBHAL_PLATFORM_LIBRARY}) -set(platform $ENV{LIBHAL_PLATFORM}) - -message(WARNING "${platform_library}") - -if("${platform_library}" STREQUAL "") - message(FATAL_ERROR - "Build environment variable LIBHAL_PLATFORM_LIBRARY is required for " "this project.") -endif() - -find_package(libhal-${platform_library} REQUIRED CONFIG) -find_package(libhal-__device__ REQUIRED CONFIG) -find_package(libhal-util REQUIRED CONFIG) - -set(DEMOS __device__) - -add_library(startup_code - main.cpp - platforms/${platform}.cpp) -target_include_directories(startup_code PUBLIC .) -target_compile_features(startup_code PRIVATE cxx_std_20) -target_link_libraries(startup_code PRIVATE - libhal::${platform_library} - libhal::__device__ - libhal::util) - -foreach(demo IN LISTS DEMOS) - set(current_project ${demo}.elf) - message(STATUS "Generating Demo for \"${current_project}\"") - add_executable(${current_project} applications/${demo}.cpp) - target_include_directories(${current_project} PUBLIC .) - target_compile_features(${current_project} PRIVATE cxx_std_20) - target_compile_options(${current_project} PRIVATE -g) - target_link_options(${current_project} PRIVATE --oslib=semihost) - target_link_libraries(${current_project} PRIVATE - libhal::${platform_library} - libhal::__device__ - libhal::util - startup_code) - libhal_post_build(${current_project}) -endforeach() diff --git a/demos/baremetal.profile b/demos/baremetal.profile deleted file mode 100644 index 6dac80a..0000000 --- a/demos/baremetal.profile +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -build_type=Release -compiler=gcc -compiler.cppstd=20 -compiler.libcxx=libstdc++ -compiler.version=12.3 -arch=cortex-m4f -os=baremetal diff --git a/demos/conanfile.py b/demos/conanfile.py deleted file mode 100644 index 6dc575c..0000000 --- a/demos/conanfile.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2024 Khalil Estell -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from conan import ConanFile -from conan.tools.cmake import CMake, cmake_layout - - -class demos(ConanFile): - settings = "compiler", "build_type", "os", "arch" - generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv" - - def build_requirements(self): - self.tool_requires("cmake/3.27.1") - - def requirements(self): - self.requires("cortex-m-exceptions/0.0.0") - - def layout(self): - arch_directory = "build/" + str(self.settings.arch) - cmake_layout(self, build_folder=arch_directory) - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() diff --git a/demos/linker.ld b/demos/linker.ld deleted file mode 100644 index 549a0b5..0000000 --- a/demos/linker.ld +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2023 Khalil Estell - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -__flash = 0x00000000; -__flash_size = 512K; -__ram = 0x10000000; -__ram_size = 64K; -__stack_size = 1K; - -INCLUDE "../../third_party/standard_arm.ld" diff --git a/demos/main.cpp b/demos/main.cpp deleted file mode 100644 index a67e8d1..0000000 --- a/demos/main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2024 Khalil Estell -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -int -main() -{ -} - -extern "C" -{ - void _exit(int) - { - while (true) { - continue; - } - } - int kill(int, int) - { - return -1; - } - int getpid() - { - return 1; - } -} \ No newline at end of file diff --git a/src/builtin/gcc/impl.cpp b/src/builtin/gcc/impl.cpp index 491c82e..c3b0593 100644 --- a/src/builtin/gcc/impl.cpp +++ b/src/builtin/gcc/impl.cpp @@ -30,8 +30,6 @@ extern "C" std::terminate(); } - struct _reent* _impure_ptr = nullptr; // NOLINT - void* __wrap___cxa_allocate_exception(unsigned int p_size) // NOLINT { // Size of the GCC exception object header is 128 bytes. Will have to update diff --git a/src/control.cpp b/src/control.cpp index 3a2feb1..ac101af 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -20,6 +20,28 @@ namespace __cxxabiv1 { // NOLINT std::terminate_handler __terminate_handler = +[]() { // NOLINT + // So you may be wondering what this code is doing here? Its actually a + // bit of weird circular logic. So the linker will garbage collect any + // functions that are not used in your code. If you somehow have an + // application without any exceptions thrown, the exception code will be + // eliminated. This would be great, but due the fact that our build system + // adds the `-Wl,--wrap=symbol` to the compiler to swap the function + // implementations, this results in the compiler yelling at the user that + // they are missing a wrapped function. In order to prevent the compiler + // from throwing away this function and then turning around demanding that + // we supply it, we simply need to call throw somewhere in the code. That + // will force it to link in the original implementations which will be + // swapped out with our wrapped implementations. + // + // Use a volatile bool that is always set to false to ensure that the + // "throw 5" is NEVER called. + // + // This location was choosen because it always links in for GCC. + volatile bool force_exceptions_to_link = false; + if (force_exceptions_to_link) { + throw 5; + } + while (true) { continue; }