Skip to content

Commit

Permalink
wip: Various changes, fixing doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
Teufelchen1 committed Mar 27, 2024
1 parent e4eaeb8 commit 95daad1
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 79 deletions.
2 changes: 1 addition & 1 deletion boards/gba_cartridge/Makefile.include
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FLASHFILE = $(HEXFILE)
FLASHFILE = $(BINFILE)
7 changes: 0 additions & 7 deletions boards/gba_cartridge/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cpu/arm7tdmi_gba/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ ifeq (,$(filter stdio_%,$(USEMODULE)))
USEMODULE += stdio_fb
endif

DISABLE_MODULE += periph_init_leds

include $(RIOTCPU)/arm7_common/Makefile.dep
1 change: 0 additions & 1 deletion cpu/arm7tdmi_gba/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += picolibc
FEATURES_PROVIDED += periph_pm
40 changes: 20 additions & 20 deletions cpu/arm7tdmi_gba/cartridge_header.s
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 5 additions & 0 deletions cpu/arm7tdmi_gba/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @defgroup cpu_arm7tdmi_gba GBAs ARM7TDMI
* @ingroup cpu
* @brief Nintendos ARM7TDMI on the GBA
*/
4 changes: 1 addition & 3 deletions cpu/arm7tdmi_gba/include/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 7 additions & 12 deletions cpu/arm7tdmi_gba/include/cpu_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -95,5 +91,4 @@ extern "C"
}
#endif

/** @} */
#endif /* CPU_CONF_H */
5 changes: 5 additions & 0 deletions cpu/arm7tdmi_gba/include/periph_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ extern "C"
{
#endif

/**
* @brief Clock configuration
*/
#define CLOCK_CORECLOCK (16780000U) /* 16.78MHz */

#ifdef __cplusplus
}
#endif
Expand Down
74 changes: 39 additions & 35 deletions cpu/arm7tdmi_gba/include/periph_gba.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
*/

/**
* @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 <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define PM_NUM_MODES 0

/**
* @brief Type for 32-bit registers
*/
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions cpu/arm7tdmi_gba/ldscripts/arm7tdmi_gba.ld
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions cpu/arm7tdmi_gba/stdio_fb/font_terminal.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef FONT_TERMINAL_H
#define FONT_TERMINAL_H

#ifdef __cplusplus
extern "C"
{
Expand Down Expand Up @@ -279,3 +282,5 @@ extern "C"
#ifdef __cplusplus
}
#endif

#endif /* FONT_TERMINAL_H */
5 changes: 5 additions & 0 deletions features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions makefiles/features_existing.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ FEATURES_EXISTING := \
cortexm_mpu \
cortexm_svc \
cpp \
cpu_arm7tdmi_gba \
cpu_atmega1281 \
cpu_atmega1284p \
cpu_atmega128rfa1 \
Expand Down

0 comments on commit 95daad1

Please sign in to comment.