Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions board/edu-unt/inc/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/************************************************************************************************
Copyright (c) 2022-2024, Laboratorio de Microprocesadores
Facultad de Ciencias Exactas y Tecnología, Universidad Nacional de Tucumán
https://www.microprocesadores.unt.edu.ar/

Copyright (c) 2022-2024, Esteban Volentini <evolentini@herrera.unt.edu.ar>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SPDX-License-Identifier: MIT
*************************************************************************************************/

#ifndef BOARD_H
#define BOARD_H

/** \brief Longan NANO board declarations
**
** \addtogroup board Board support
** \brief Board agnostic configuration module
** @{ */

/* === Headers files inclusions ================================================================ */

#if defined(USE_HAL)
#include "hal.h"
#endif
#if defined(USE_DRIVERS)
#include "gd32vf103.h"
#endif

/* === Cabecera C++ ============================================================================ */

#ifdef __cplusplus
extern "C" {
#endif

/* === Public macros definitions =============================================================== */

#if defined(USE_HAL)

#elif defined(USE_DRIVERS)

// #define LED_R_GPIO GPIOA
// #define LED_R_PIN GPIO_PIN_0

// #define LED_G_GPIO GPIOA
// #define LED_G_PIN GPIO_PIN_1

// #define LED_B_GPIO GPIOA
// #define LED_B_PIN GPIO_PIN_2

#endif

/* === Public data type declarations =========================================================== */

/* === Public variable declarations ============================================================ */

/* === Public function declarations ============================================================ */

/**
* @brief Function to initilize board configuration
*/
void BoardSetup(void);

/* === End of documentation ==================================================================== */

#ifdef __cplusplus
}
#endif

/** @} End of module definition for doxygen */

#endif /* BOARD_H */
28 changes: 28 additions & 0 deletions board/edu-unt/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
##################################################################################################
# Copyright (c) 2022-2024, Laboratorio de Microprocesadores
# Facultad de Ciencias Exactas y Tecnología, Universidad Nacional de Tucumán
# https://www.microprocesadores.unt.edu.ar/
#
# Copyright (c) 2022-2024, Esteban Volentini <evolentini@herrera.unt.edu.ar>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
# OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# SPDX-License-Identifier: MIT
##################################################################################################

MCU ?= gd32vf103cbt6

USE_DRIVERS ?= y
63 changes: 63 additions & 0 deletions board/edu-unt/src/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/************************************************************************************************
Copyright (c) 2022-2024, Laboratorio de Microprocesadores
Facultad de Ciencias Exactas y Tecnología, Universidad Nacional de Tucumán
https://www.microprocesadores.unt.edu.ar/

Copyright (c) 2022-2024, Esteban Volentini <evolentini@herrera.unt.edu.ar>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SPDX-License-Identifier: MIT
*************************************************************************************************/

/** \brief Longan NANO board configuration implementation
**
** \addtogroup board Board support
** \brief Board agnostic configuration module
** @{ */

/* === Headers files inclusions =============================================================== */

#include "board.h"
#include "gd32vf103.h"

/* === Macros definitions ====================================================================== */

/* === Private data type declarations ========================================================== */

/* === Private variable declarations =========================================================== */

/* === Private function declarations =========================================================== */

/* === Public variable definitions ============================================================= */

/* === Private variable definitions ============================================================ */

/* === Private function implementation ========================================================= */

/* === Public function implementation ========================================================== */

void BoardSetup(void) {
#ifdef USE_DRIVERS
SystemInit();
SystemCoreClockUpdate();
#endif
}

/* === End of documentation ====================================================================
*/

/** @} End of module definition for doxygen */
4 changes: 0 additions & 4 deletions external/base/arch/rv32/core/src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@ extern int _put_char(int ch) __attribute__((weak));
size_t __write(int handle, const unsigned char *buf, size_t bufSize)
{
size_t nChars = 0;

if (handle == -1)
{
return 0;
}

for (; bufSize > 0; --bufSize)
{
_put_char((uint8_t) *buf);
++buf;
++nChars;
}

return nChars;
}

int puts(const char* string) {
return __write(0, (const void *) string, strlen(string));
}

#elif defined ( __GNUC__ )
ssize_t _write(int fd, const void* ptr, size_t len) {
const uint8_t * current = (const uint8_t *) ptr;
Expand Down
16 changes: 16 additions & 0 deletions external/base/mcu/gd32f103c8/linker/release.ld
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
<<<<<<< HEAD
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
=======
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
>>>>>>> origin/main
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
}

Expand Down Expand Up @@ -83,7 +87,11 @@ SECTIONS
_sidata = LOADADDR(.data);

/* Initialized data sections goes into RAM, load LMA copy after code */
<<<<<<< HEAD
.data :
=======
.data :
>>>>>>> origin/main
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
Expand All @@ -94,7 +102,11 @@ SECTIONS
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH

<<<<<<< HEAD

=======

>>>>>>> origin/main
/* Uninitialized data section */
. = ALIGN(4);
.bss :
Expand Down Expand Up @@ -122,7 +134,11 @@ SECTIONS
. = ALIGN(8);
} >RAM

<<<<<<< HEAD

=======

>>>>>>> origin/main

/* Remove information from the standard libraries */
/DISCARD/ :
Expand Down
7 changes: 4 additions & 3 deletions external/base/mcu/gd32f103c8/startup/startup_gd32f10x_md.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.cpu cortex-m3
.fpu softvfp
.thumb

.global g_pfnVectors
.global Default_Handler

Expand Down Expand Up @@ -32,7 +31,6 @@ CopyDataInit:
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4

LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
Expand All @@ -46,7 +44,6 @@ FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4

LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
Expand Down Expand Up @@ -316,3 +313,7 @@ g_pfnVectors:

.weak EXMC_IRQHandler
.thumb_set EXMC_IRQHandler,Default_Handler
<<<<<<< HEAD

=======
>>>>>>> origin/main
Loading