diff --git a/cross/Makefile b/cross/Makefile index d05510b..46d361d 100644 --- a/cross/Makefile +++ b/cross/Makefile @@ -18,7 +18,7 @@ include gmp.mk include isl.mk include cloog.mk -fetch: gawk.tar.xz gcc.tar.bz2 binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz +fetch: gawk.tar.xz gcc.tar.xz binutils.tar.bz2 mpc.tar.gz mpfr.tar.xz gmp.tar.xz isl.tar.xz cloog.tar.gz extract: gawk/ binutils/ gcc/mpc/ gcc/mpfr/ gcc/gmp/ gcc/isl/ gcc/cloog/ diff --git a/cross/binutils.mk b/cross/binutils.mk index bca12e1..1d05f01 100644 --- a/cross/binutils.mk +++ b/cross/binutils.mk @@ -1,4 +1,4 @@ -BINUTILS_VERSION=2.28 +BINUTILS_VERSION=2.29.1 binutils.tar.bz2: binutils-$(BINUTILS_VERSION).tar.bz2 mv $^ $@ diff --git a/cross/gawk.mk b/cross/gawk.mk index 322b216..b071cfd 100644 --- a/cross/gawk.mk +++ b/cross/gawk.mk @@ -1,4 +1,4 @@ -GAWK_VERSION=4.1.4 +GAWK_VERSION=4.2.0 gawk.tar.xz: gawk-$(GAWK_VERSION).tar.xz mv $^ $@ diff --git a/cross/gcc.mk b/cross/gcc.mk index 423442b..50ec445 100644 --- a/cross/gcc.mk +++ b/cross/gcc.mk @@ -1,15 +1,15 @@ -GCC_VERSION=7.1.0 -GCC_MAJOR_VERSION=7.1.0 -gcc.tar.bz2: gcc-$(GCC_VERSION).tar.bz2 +GCC_VERSION=7.2.0 +GCC_MAJOR_VERSION=7.2.0 +gcc.tar.xz: gcc-$(GCC_VERSION).tar.xz mv $^ $@ -gcc-$(GCC_VERSION).tar.bz2: +gcc-$(GCC_VERSION).tar.xz: wget https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_MAJOR_VERSION)/$@ gcc/: gcc-$(GCC_VERSION)/ mv $^ $@ -gcc-$(GCC_VERSION)/: gcc.tar.bz2 +gcc-$(GCC_VERSION)/: gcc.tar.xz tar -xf $^ gcc-patch: @@ -28,4 +28,5 @@ gcc-make: gcc-configure $(MAKE) -C builddir all-target-libgcc gcc-install: gcc-make - $(MAKE) -C builddir install-gcc install-target-libgcc + $(MAKE) -C builddir install-gcc + $(MAKE) -C builddir install-target-libgcc diff --git a/cross/mpfr.mk b/cross/mpfr.mk index 298954a..99f6a1d 100644 --- a/cross/mpfr.mk +++ b/cross/mpfr.mk @@ -1,4 +1,4 @@ -MPFR_VERSION=3.1.5 +MPFR_VERSION=3.1.6 mpfr.tar.xz: mpfr-$(MPFR_VERSION).tar.xz mv $^ $@ diff --git a/do_all.sh b/do_all.sh index 8f00403..f685068 100755 --- a/do_all.sh +++ b/do_all.sh @@ -64,6 +64,7 @@ buildtools/sighax-firm.sh && mv sighax.firm out/ && cp -v build/kernel/kernel out/arm11loaderhax.elf +cat > /dev/null << EOF { echo 2 echo 1 @@ -75,3 +76,4 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-none-eabi.cmake .. && make -j$(nproc) && popd && cp -v build/kernel/kernel out/raspi2.elf +EOF diff --git a/fontgen.py b/fontgen.py index 9dc6c8e..aed001e 100755 --- a/fontgen.py +++ b/fontgen.py @@ -42,7 +42,10 @@ f.write("char font_data[] = {\n") for i,c in enumerate(fontbytes): if not i % 32: f.write(" ") - f.write(hex(c)+", ") + if c < 0x80: + f.write(hex(c)+", ") + else: + f.write("(char)"+hex(127-c^0x7F)+", ") if i % 32 == 31: f.write("\n") f.write("\n};\n") diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index db2087e..d227ee1 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -30,8 +30,8 @@ LOAD_PROFILE(${ARCH} ${SYSTEM}) ADD_EXECUTABLE(kernel ${PLATFORM_SRCS} ${ISA_SRCS} ${GENERIC_SRCS}) SET(CMAKE_ASM-ATT_COMPILE_OBJECT " -g -x assembler-with-cpp -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_ASM_FLAGS} ${PLATFORM_ASM_FLAGS} -c -o ") -SET(CMAKE_C_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}") -SET(CMAKE_CXX_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}") +SET(CMAKE_C_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}") +SET(CMAKE_CXX_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}") SET_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS "-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -Wl,--gc-sections -ffreestanding") TARGET_LINK_LIBRARIES(kernel gcc) diff --git a/kernel/arch/arm/interrupt.cpp b/kernel/arch/arm/interrupt.cpp index 782176e..ba6737a 100644 --- a/kernel/arch/arm/interrupt.cpp +++ b/kernel/arch/arm/interrupt.cpp @@ -22,7 +22,7 @@ void print_regdump(cpu_state *state) { (*out << " returnAddr: ").puti(state->returnAddr); *out << "\n"; } -extern "C" void panic2(char *msg, cpu_state *state); +extern "C" void panic2(const char *msg, cpu_state *state); extern "C" cpu_state *handleINT(int number, cpu_state *state) { *out << "Interrupt"; out->puti(number); @@ -49,7 +49,7 @@ extern "C" cpu_state *handleINT(int number, cpu_state *state) { } return new_cpu; } -extern "C" void panic2(char *msg, cpu_state *state) { +extern "C" void panic2(const char *msg, cpu_state *state) { out->setColor(Color::RED); *out << "KERNEL PANIC: " << msg << "\n"; print_regdump(state); diff --git a/kernel/arch/x86/paging.cpp b/kernel/arch/x86/paging.cpp index 5dec4d3..d74a7a3 100644 --- a/kernel/arch/x86/paging.cpp +++ b/kernel/arch/x86/paging.cpp @@ -47,7 +47,7 @@ paging_context_x86::paging_context_x86(): paging_context() { continue; if(i == 1 || i == 2 || i == 3) continue; - pagetbl *pagetbl_start = (pagetbl *)(0x800000 + i << 22); + pagetbl *pagetbl_start = (pagetbl *)(0x800000 + (i << 22)); for(int j=0;j<1024;j++) { if(!pagetbl_start[j].active) continue; @@ -147,7 +147,7 @@ paging_context_x86::~paging_context_x86() { for(int i=256;i<1024;i++) { if(!pd[i].active) continue; - pagetbl *pt = (pagetbl*)(0xC00000+i<<12); + pagetbl *pt = (pagetbl*)(0xC00000+(i<<12)); for(int j=0;j<1024;j++) { if(!pt[j].active) continue; @@ -161,7 +161,7 @@ paging_context_x86::~paging_context_x86() { for(int i=1;i<3;i++) { if(!pd[i].active) continue; - pagetbl *pt = (pagetbl*)(0xC00000+i<<12); + pagetbl *pt = (pagetbl*)(0xC00000+(i<<12)); for(int j=0;j<1024;j++) { if(!pt[j].active) continue; diff --git a/kernel/hw/3ds11/i2c/i2c.cpp b/kernel/hw/3ds11/i2c/i2c.cpp index f79b0d9..852c8c7 100644 --- a/kernel/hw/3ds11/i2c/i2c.cpp +++ b/kernel/hw/3ds11/i2c/i2c.cpp @@ -16,7 +16,7 @@ auto I2C::getResult() -> bool { waitBusy(); return buses[busID]->ctl & 0x10; } -auto I2C::stop() -> bool { +auto I2C::stop() -> void { buses[busID]->ctl = 0xC0; waitBusy(); buses[busID]->ctl = 0xC5; diff --git a/kernel/hw/3ds11/i2c/i2c.hpp b/kernel/hw/3ds11/i2c/i2c.hpp index ef1498c..4c6a7fd 100644 --- a/kernel/hw/3ds11/i2c/i2c.hpp +++ b/kernel/hw/3ds11/i2c/i2c.hpp @@ -15,7 +15,7 @@ class I2C { ~I2C(); auto waitBusy() -> void; ///< Waits for the currently selected device to finish auto getResult() -> bool; ///< Returns true when the device sent a ACK - auto stop() -> bool; ///< Stops the current transfer + auto stop() -> void; ///< Stops the current transfer auto selectDev(int dev) -> bool; ///< Selects current I2C device auto selectReg(int reg) -> bool; ///< Selects current register auto write(uint8_t data) -> bool; ///< Sends 8 bits of data diff --git a/kernel/hw/3ds11/mcu/mcu.cpp b/kernel/hw/3ds11/mcu/mcu.cpp index b75faab..7766923 100644 --- a/kernel/hw/3ds11/mcu/mcu.cpp +++ b/kernel/hw/3ds11/mcu/mcu.cpp @@ -51,7 +51,7 @@ auto getRTC(RTC_date *date) -> void { date->years = bcdToVal(read(0x36)); } auto setRTC(RTC_date *date) -> void { - auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + (c / 10) << 4; }; + auto valToBCD = [](unsigned char c) -> unsigned char { return (c % 10) + ((c / 10) << 4); }; write(0x30, valToBCD(date->seconds)); write(0x31, valToBCD(date->minutes)); write(0x32, valToBCD(date->hours)); diff --git a/kernel/hw/3ds11/vectorinit/vectorinit.cpp b/kernel/hw/3ds11/vectorinit/vectorinit.cpp index 2d445d7..8ea3800 100644 --- a/kernel/hw/3ds11/vectorinit/vectorinit.cpp +++ b/kernel/hw/3ds11/vectorinit/vectorinit.cpp @@ -32,7 +32,7 @@ IRQ_IO::IRQ_IO() { *((volatile uint32_t*)(0x17E01100+i))=~0; } uint32_t intid; - while((intid=*((volatile uint32_t*)0x17E00118))&1023!=1023) { + while(((intid=*((volatile uint32_t*)0x17E00118))&1023)!=1023) { *((volatile uint32_t*)0x17E00110)=intid; } } diff --git a/kernel/hw/pc/idt/idt.cpp b/kernel/hw/pc/idt/idt.cpp index 7bc46ea..530167d 100644 --- a/kernel/hw/pc/idt/idt.cpp +++ b/kernel/hw/pc/idt/idt.cpp @@ -23,7 +23,7 @@ void setIDTEntry(int i, void *entry) { #endif } void initIDT() { - void *start_vectors = (void *)&intr_stub_0; + char *start_vectors = (char *)&intr_stub_0; for (int i = 0; i < 256; i++) setIDTEntry(i, start_vectors + 16 * i); struct { uint16_t size; diff --git a/kernel/src/cppstubs.cpp b/kernel/src/cppstubs.cpp index 177390b..e92e96c 100644 --- a/kernel/src/cppstubs.cpp +++ b/kernel/src/cppstubs.cpp @@ -23,4 +23,5 @@ extern "C" int __cxa_guard_acquire(__guard *g) { } extern "C" int __cxa_guard_release(__guard *g) { *(char *)g = 1; + return 0; }