From 95daad159fc645d61e14ea531095b12b0de34e71 Mon Sep 17 00:00:00 2001 From: Teufelchen1 Date: Fri, 16 Jun 2023 17:32:44 +0200 Subject: [PATCH] wip: Various changes, fixing doxygen --- boards/gba_cartridge/Makefile.include | 2 +- boards/gba_cartridge/include/periph_conf.h | 7 -- cpu/arm7tdmi_gba/Makefile.dep | 1 + cpu/arm7tdmi_gba/Makefile.features | 1 - cpu/arm7tdmi_gba/cartridge_header.s | 40 ++++++------ cpu/arm7tdmi_gba/doc.txt | 5 ++ cpu/arm7tdmi_gba/include/cpu.h | 4 +- cpu/arm7tdmi_gba/include/cpu_conf.h | 19 ++---- cpu/arm7tdmi_gba/include/periph_cpu.h | 5 ++ cpu/arm7tdmi_gba/include/periph_gba.h | 74 ++++++++++++---------- cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld | 9 +++ cpu/arm7tdmi_gba/stdio_fb/font_terminal.h | 5 ++ features.yaml | 5 ++ makefiles/features_existing.inc.mk | 1 + 14 files changed, 99 insertions(+), 79 deletions(-) create mode 100644 cpu/arm7tdmi_gba/doc.txt diff --git a/boards/gba_cartridge/Makefile.include b/boards/gba_cartridge/Makefile.include index 01b5c73b1011c..a8ee432a45a73 100644 --- a/boards/gba_cartridge/Makefile.include +++ b/boards/gba_cartridge/Makefile.include @@ -1 +1 @@ -FLASHFILE = $(HEXFILE) +FLASHFILE = $(BINFILE) diff --git a/boards/gba_cartridge/include/periph_conf.h b/boards/gba_cartridge/include/periph_conf.h index 7743c7df46938..fd48dc97819ac 100644 --- a/boards/gba_cartridge/include/periph_conf.h +++ b/boards/gba_cartridge/include/periph_conf.h @@ -26,13 +26,6 @@ extern "C" { #endif -/** - * @name Clock configuration - * @{ - */ -#define CLOCK_CORECLOCK (16780000U) /* this board runs with 16.78MHz */ -#define CLOCK_PCLK (CLOCK_CORECLOCK) - #ifdef __cplusplus } #endif diff --git a/cpu/arm7tdmi_gba/Makefile.dep b/cpu/arm7tdmi_gba/Makefile.dep index 1adb6c223cf76..9a65e9ab36a55 100644 --- a/cpu/arm7tdmi_gba/Makefile.dep +++ b/cpu/arm7tdmi_gba/Makefile.dep @@ -4,5 +4,6 @@ ifeq (,$(filter stdio_%,$(USEMODULE))) USEMODULE += stdio_fb endif +DISABLE_MODULE += periph_init_leds include $(RIOTCPU)/arm7_common/Makefile.dep diff --git a/cpu/arm7tdmi_gba/Makefile.features b/cpu/arm7tdmi_gba/Makefile.features index aafedc952091b..08741a5846012 100644 --- a/cpu/arm7tdmi_gba/Makefile.features +++ b/cpu/arm7tdmi_gba/Makefile.features @@ -8,4 +8,3 @@ FEATURES_PROVIDED += cpp FEATURES_PROVIDED += libstdcpp FEATURES_PROVIDED += newlib FEATURES_PROVIDED += picolibc -FEATURES_PROVIDED += periph_pm diff --git a/cpu/arm7tdmi_gba/cartridge_header.s b/cpu/arm7tdmi_gba/cartridge_header.s index 50a73a73c0979..f3aea69251ffb 100644 --- a/cpu/arm7tdmi_gba/cartridge_header.s +++ b/cpu/arm7tdmi_gba/cartridge_header.s @@ -1,26 +1,26 @@ .section .gbaheader b _startup // Nintendo Logo data - .byte 0x24, 0xFF, 0xAE, 0x51, 0x69, 0x9A, 0xA2, 0x21 - .byte 0x3D, 0x84, 0x82, 0x0A, 0x84, 0xE4, 0x09, 0xAD - .byte 0x11, 0x24, 0x8B, 0x98, 0xC0, 0x81, 0x7F, 0x21 - .byte 0xA3, 0x52, 0xBE, 0x19, 0x93, 0x09, 0xCE, 0x20 - .byte 0x10, 0x46, 0x4A, 0x4A, 0xF8, 0x27, 0x31, 0xEC - .byte 0x58, 0xC7, 0xE8, 0x33, 0x82, 0xE3, 0xCE, 0xBF - .byte 0x85, 0xF4, 0xDF, 0x94, 0xCE, 0x4B, 0x09, 0xC1 - .byte 0x94, 0x56, 0x8A, 0xC0, 0x13, 0x72, 0xA7, 0xFC - .byte 0x9F, 0x84, 0x4D, 0x73, 0xA3, 0xCA, 0x9A, 0x61 - .byte 0x58, 0x97, 0xA3, 0x27, 0xFC, 0x03, 0x98, 0x76 - .byte 0x23, 0x1D, 0xC7, 0x61, 0x03, 0x04, 0xAE, 0x56 - .byte 0xBF, 0x38, 0x84, 0x00, 0x40, 0xA7, 0x0E, 0xFD - .byte 0xFF, 0x52, 0xFE, 0x03, 0x6F, 0x95, 0x30, 0xF1 - .byte 0x97, 0xFB, 0xC0, 0x85, 0x60, 0xD6, 0x80, 0x25 - .byte 0xA9, 0x63, 0xBE, 0x03, 0x01, 0x4E, 0x38, 0xE2 - .byte 0xF9, 0xA2, 0x34, 0xFF, 0xBB, 0x3E, 0x03, 0x44 - .byte 0x78, 0x00, 0x90, 0xCB, 0x88, 0x11, 0x3A, 0x94 - .byte 0x65, 0xC0, 0x7C, 0x63, 0x87, 0xF0, 0x3C, 0xAF - .byte 0xD6, 0x25, 0xE4, 0x8B, 0x38, 0x0A, 0xAC, 0x72 - .byte 0x21, 0xD4, 0xF8, 0x07 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 // ASCII Game title .ascii "\0\0\0\0\0\0\0\0\0\0\0\0" diff --git a/cpu/arm7tdmi_gba/doc.txt b/cpu/arm7tdmi_gba/doc.txt new file mode 100644 index 0000000000000..359d943c28dc9 --- /dev/null +++ b/cpu/arm7tdmi_gba/doc.txt @@ -0,0 +1,5 @@ +/** + * @defgroup cpu_arm7tdmi_gba GBAs ARM7TDMI + * @ingroup cpu + * @brief Nintendos ARM7TDMI on the GBA + */ diff --git a/cpu/arm7tdmi_gba/include/cpu.h b/cpu/arm7tdmi_gba/include/cpu.h index 924bee741f91d..b57b95cdca29a 100644 --- a/cpu/arm7tdmi_gba/include/cpu.h +++ b/cpu/arm7tdmi_gba/include/cpu.h @@ -10,9 +10,7 @@ #define CPU_H /** - * @defgroup cpu_arm7tdmi_gba Nintendo ARM7TDMI - * @ingroup cpu - * @brief Nintendo ARM7TDMI Game Boy Advance specific code + * @ingroup cpu_arm7tdmi_gba * @{ */ #include "arm_cpu.h" diff --git a/cpu/arm7tdmi_gba/include/cpu_conf.h b/cpu/arm7tdmi_gba/include/cpu_conf.h index 3325a31da875a..f52c1ddb16b15 100644 --- a/cpu/arm7tdmi_gba/include/cpu_conf.h +++ b/cpu/arm7tdmi_gba/include/cpu_conf.h @@ -45,43 +45,39 @@ extern "C" #ifndef THREAD_STACKSIZE_IDLE #define THREAD_STACKSIZE_IDLE (160) #endif +/** @} */ /** * @brief Stack size used for the undefined instruction interrupt stack - * @{ */ #define UND_STACKSIZE (64) -/** @} */ /** * @brief Stack size used for the abort interrupt stack - * @{ */ #define ABT_STACKSIZE (64) -/** @} */ /** * @brief Stack size used for the interrupt (ISR) stack - * @{ */ #ifndef ISR_STACKSIZE -#define ISR_STACKSIZE (64) +#define ISR_STACKSIZE (400) #endif -/** @} */ /** * @brief Stack size used for the fast interrupt (FIQ) stack - * @{ */ #define FIQ_STACKSIZE (64) -/** @} */ + +/** + * @brief Stack size used for the supervisor mode (SVC) stack + */ +#define SVC_STACKSIZE (400) /** * @brief Stack size used for the user mode/kernel init stack - * @{ */ #define USR_STACKSIZE (4096) -/** @} */ /** * @brief The CPU has 2 blocks of SRAM at different addresses. @@ -95,5 +91,4 @@ extern "C" } #endif -/** @} */ #endif /* CPU_CONF_H */ diff --git a/cpu/arm7tdmi_gba/include/periph_cpu.h b/cpu/arm7tdmi_gba/include/periph_cpu.h index d7d6fde9254b2..9e93b4049d60a 100644 --- a/cpu/arm7tdmi_gba/include/periph_cpu.h +++ b/cpu/arm7tdmi_gba/include/periph_cpu.h @@ -25,6 +25,11 @@ extern "C" { #endif +/** + * @brief Clock configuration + */ +#define CLOCK_CORECLOCK (16780000U) /* 16.78MHz */ + #ifdef __cplusplus } #endif diff --git a/cpu/arm7tdmi_gba/include/periph_gba.h b/cpu/arm7tdmi_gba/include/periph_gba.h index bb36ea925b7fa..429b7701b3593 100644 --- a/cpu/arm7tdmi_gba/include/periph_gba.h +++ b/cpu/arm7tdmi_gba/include/periph_gba.h @@ -7,17 +7,18 @@ */ /** - * @ingroup cpu_arm7tdmi_gba + * @ingroup cpu_arm7tdmi_gba * @{ * * @file - * @brief GBA specific definitions for internal peripheral handling + * @brief GBA specific definitions for internal peripheral handling * - * @author + * @author Bennet Blischke */ #ifndef PERIPH_GBA_H #define PERIPH_GBA_H + #include #ifdef __cplusplus @@ -25,8 +26,6 @@ extern "C" { #endif -#define PM_NUM_MODES 0 - /** * @brief Type for 32-bit registers */ @@ -42,13 +41,13 @@ extern "C" */ #define MEM16(ADDR) ((uint16_t(*))(ADDR)) - /** - * @name Display and screen registers + * @brief Screen dimension in pixel * @{ */ -#define GBA_SCREEN_WIDTH 240 -#define GBA_SCREEN_HEIGHT 160 +#define GBA_SCREEN_WIDTH (240) /**< width */ +#define GBA_SCREEN_HEIGHT (160) /**< height */ +/** @} */ /** * @brief Display Control register @@ -59,39 +58,44 @@ extern "C" * @name Settings for GBA_DISPCNT * @{ */ -/* Tiled, four layers, up to 1024 tiles */ -#define GBA_DISPCNT_BGMODE_0 0x0000 -/* Tiled, three layers, up to 1024 tiles */ -#define GBA_DISPCNT_BGMODE_1 0x0001 -/* Tiled, two layers, up to 1024 tiles */ -#define GBA_DISPCNT_BGMODE_2 0x0002 -/* Bitmap, 240x160, 15-bit RGB */ -#define GBA_DISPCNT_BGMODE_3 0x0003 -/* Bitmap, 240x160, 8-bit RGB */ -#define GBA_DISPCNT_BGMODE_4 0x0004 -/* Bitmap, 160x128, 15-bit RGB */ -#define GBA_DISPCNT_BGMODE_5 0x0005 - -/* Enable display of background 0..3 */ -#define GBA_DISPCNT_SDBG_0 0x0100 -#define GBA_DISPCNT_SDBG_1 0x0200 -#define GBA_DISPCNT_SDBG_2 0x0400 -#define GBA_DISPCNT_SDBG_3 0x0800 - -/* Enable display of objects */ -#define GBA_DISPCNT_SDOBJ 0x1000 +#define GBA_DISPCNT_BGMODE_0 0x0000 /**< Tiled, four layers, up to 1024 tiles */ +#define GBA_DISPCNT_BGMODE_1 0x0001 /**< Tiled, three layers, up to 1024 tiles */ +#define GBA_DISPCNT_BGMODE_2 0x0002 /**< Tiled, two layers, up to 1024 tiles */ +#define GBA_DISPCNT_BGMODE_3 0x0003 /**< Bitmap, 240x160, 15-bit RGB */ +#define GBA_DISPCNT_BGMODE_4 0x0004 /**< Bitmap, 240x160, 8-bit RGB */ +#define GBA_DISPCNT_BGMODE_5 0x0005 /**< Bitmap, 160x128, 15-bit RGB */ + +#define GBA_DISPCNT_SDBG_0 0x0100 /**< Enable display of background 0 */ +#define GBA_DISPCNT_SDBG_1 0x0200 /**< Enable display of background 1 */ +#define GBA_DISPCNT_SDBG_2 0x0400 /**< Enable display of background 2 */ +#define GBA_DISPCNT_SDBG_3 0x0800 /**< Enable display of background 3 */ + +#define GBA_DISPCNT_SDOBJ 0x1000 /**< Enable display of objects */ +/** @} */ +/** + * @brief General LCD Status register + */ #define GBA_DISPSTAT REG16(0x4000004) -#define GBA_BG0CNT REG16(0x4000008) -#define GBA_BG1CNT REG16(0x400000a) -#define GBA_BG2CNT REG16(0x400000c) -#define GBA_BG3CNT REG16(0x400000e) +/** + * @name LCD background control registers + * @{ + */ +#define GBA_BG0CNT REG16(0x4000008) /**< BG0 */ +#define GBA_BG1CNT REG16(0x400000a) /**< BG1 */ +#define GBA_BG2CNT REG16(0x400000c) /**< BG2 */ +#define GBA_BG3CNT REG16(0x400000e) /**< BG3 */ /** @} */ +/** + * @brief VRAM color palette memory + */ #define GBA_VRAM_PALETTE MEM16(0x5000000) -/* 96Kb, 0x6017FFF - depends on display mode! */ +/** + * @brief VRAM, 96Kb, 0x6017FFF - size depends on display mode! + */ #define GBA_VRAM MEM16(0x6000000) #ifdef __cplusplus diff --git a/cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld b/cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld index 9c2c267d59af2..98c91d1fffe3c 100644 --- a/cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld +++ b/cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld @@ -1,3 +1,12 @@ +/* + * Copyright 2013, Freie Universitaet Berlin (FUB). All rights reserved. + * 2024, HAW Hamburg + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + MEMORY { ewram : ORIGIN = 0x2000000, LENGTH = 256K /* on board ram, slower */ ram (w!rx) : ORIGIN = 0x3000000, LENGTH = 32K /* on chip ram, faster */ diff --git a/cpu/arm7tdmi_gba/stdio_fb/font_terminal.h b/cpu/arm7tdmi_gba/stdio_fb/font_terminal.h index 37ed739fd8080..0ae779239af75 100644 --- a/cpu/arm7tdmi_gba/stdio_fb/font_terminal.h +++ b/cpu/arm7tdmi_gba/stdio_fb/font_terminal.h @@ -1,3 +1,6 @@ +#ifndef FONT_TERMINAL_H +#define FONT_TERMINAL_H + #ifdef __cplusplus extern "C" { @@ -279,3 +282,5 @@ extern "C" #ifdef __cplusplus } #endif + +#endif /* FONT_TERMINAL_H */ diff --git a/features.yaml b/features.yaml index 4b979f21c5a43..e24b54385b034 100644 --- a/features.yaml +++ b/features.yaml @@ -276,6 +276,11 @@ groups: - name: cpu_qn908x help: The MCU is part of the NXP QN908x family + - title: Nintendo Grouping + features: + - name: cpu_arm7tdmi_gba + help: The MCU of the Game Boy Advance. + - title: Raspberry Pi Grouping features: - name: cpu_rpx0xx diff --git a/makefiles/features_existing.inc.mk b/makefiles/features_existing.inc.mk index 5d4d7359cdabc..b6308c380decb 100644 --- a/makefiles/features_existing.inc.mk +++ b/makefiles/features_existing.inc.mk @@ -47,6 +47,7 @@ FEATURES_EXISTING := \ cortexm_mpu \ cortexm_svc \ cpp \ + cpu_arm7tdmi_gba \ cpu_atmega1281 \ cpu_atmega1284p \ cpu_atmega128rfa1 \