From e41b942c3840343c507b59916b45a001dab4ef01 Mon Sep 17 00:00:00 2001 From: Morten Delenk Date: Sun, 30 Apr 2017 09:39:53 +0000 Subject: [PATCH] fixed arm9 added optimizations to 3ds* --- kernel/CMakeLists.txt | 7 ++++--- kernel/arch/arm/3ds11/flags.cmake | 2 +- kernel/arch/arm/3ds9/flags.cmake | 2 +- kernel/arch/arm/3ds9/start.s | 8 ++++---- kernel/hw/3ds11/config.py | 3 +-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 641a467..db2087e 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -30,7 +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 -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 -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}") +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_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS - "-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -lgcc -Wl,--gc-sections") + "-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/3ds11/flags.cmake b/kernel/arch/arm/3ds11/flags.cmake index 68de179..49b6aca 100644 --- a/kernel/arch/arm/3ds11/flags.cmake +++ b/kernel/arch/arm/3ds11/flags.cmake @@ -1,3 +1,3 @@ -SET(PLATFORM_C_FLAGS "-I../../kernel/arch/arm/3ds11/include") +SET(PLATFORM_C_FLAGS "-I../../kernel/arch/arm/3ds11/include -mcpu=mpcore -mlittle-endian -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -O9") SET(PLATFORM_CXX_FLAGS "${PLATFORM_C_FLAGS}") SET(PLATFORM_ASM_FLAGS "${PLATFORM_C_FLAGS}") diff --git a/kernel/arch/arm/3ds9/flags.cmake b/kernel/arch/arm/3ds9/flags.cmake index b2882d4..081ab5a 100644 --- a/kernel/arch/arm/3ds9/flags.cmake +++ b/kernel/arch/arm/3ds9/flags.cmake @@ -1,3 +1,3 @@ -SET(PLATFORM_C_FLAGS "-I../../kernel/arch/arm/3ds9/include") +SET(PLATFORM_C_FLAGS "-I../../kernel/arch/arm/3ds9/include -mcpu=arm946e-s -march=armv5te -mthumb-interwork -mthumb -Os") SET(PLATFORM_CXX_FLAGS "${PLATFORM_C_FLAGS}") SET(PLATFORM_ASM_FLAGS "${PLATFORM_C_FLAGS}") diff --git a/kernel/arch/arm/3ds9/start.s b/kernel/arch/arm/3ds9/start.s index 90ded36..364d193 100644 --- a/kernel/arch/arm/3ds9/start.s +++ b/kernel/arch/arm/3ds9/start.s @@ -6,7 +6,7 @@ _start: mrs r0, cpsr orr r0, r0, #0x80 msr cpsr_c, r0 //Disable IRQs - //Flush instruction cache +/* //Flush instruction cache mov r0, #0 mcr p15, 0, r0, c7, c5, 0 @@ -26,9 +26,9 @@ _start: mcr p15, 0, r0, c7, c5, 0 ldr r0, =0xFFFF0830 blx r0 - +*/ ldr sp, =kernel_stack //set stack - +/* //Configure ITCM to…something mrc p15, 0, r0, c9, c1, 1 bic r0, #0b111110 @@ -85,7 +85,7 @@ _start: orr r0, r0, #(1<<2) orr r0, r0, #(1<<0) mcr p15, 0, r0, c1, c0, 0 - +*/ //Start start blx start diff --git a/kernel/hw/3ds11/config.py b/kernel/hw/3ds11/config.py index 48195e8..b077a95 100644 --- a/kernel/hw/3ds11/config.py +++ b/kernel/hw/3ds11/config.py @@ -4,8 +4,7 @@ if config["ENABLE_I2C"]: config["PROTECT_MCU"] = get_yes_no("Prevent writes to MCU firmware (Device 3, Register 5)", True) config["ENABLE_SCREENINIT"] = get_yes_no("Enable screeninit.", True) add_driver(False, "i2c") - if config["ENABLE_SCREENINIT"]: - add_driver(False, "mcu") + add_driver(False, "mcu") add_driver(True, "framebuffer") add_driver(False, "picafb") print("Enable complete Unicode font: NO (because of the size)")