mirror of
https://github.com/IcedRooibos/py32f0-template.git
synced 2025-10-29 08:52:04 -07:00
feat: ld file for 002
This commit is contained in:
parent
c46103e815
commit
01f3b5e083
@ -24,6 +24,8 @@ extern "C" {
|
|||||||
//debug printf redirect config
|
//debug printf redirect config
|
||||||
#define DEBUG_USART_BAUDRATE 115200
|
#define DEBUG_USART_BAUDRATE 115200
|
||||||
|
|
||||||
|
#if (defined(PY32F003PRE)|| defined(PY32F030PRE) || defined(PY32F072PRE))
|
||||||
|
|
||||||
#define DEBUG_USART USART2
|
#define DEBUG_USART USART2
|
||||||
#define DEBUG_USART_CLK_ENABLE() do { \
|
#define DEBUG_USART_CLK_ENABLE() do { \
|
||||||
__IO uint32_t tmpreg = 0x00U; \
|
__IO uint32_t tmpreg = 0x00U; \
|
||||||
@ -53,10 +55,41 @@ extern "C" {
|
|||||||
|
|
||||||
#define DEBUG_USART_IRQHandler USART2_IRQHandler
|
#define DEBUG_USART_IRQHandler USART2_IRQHandler
|
||||||
#define DEBUG_USART_IRQ USART2_IRQn
|
#define DEBUG_USART_IRQ USART2_IRQn
|
||||||
#endif
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
#ifdef HAL_UART_MODULE_ENABLED
|
#else
|
||||||
|
|
||||||
|
#define DEBUG_USART USART1
|
||||||
|
#define DEBUG_USART_CLK_ENABLE() do { \
|
||||||
|
__IO uint32_t tmpreg = 0x00U; \
|
||||||
|
SET_BIT(RCC->APBENR2, RCC_APBENR2_USART1EN);\
|
||||||
|
/* Delay after an RCC peripheral clock enabling */ \
|
||||||
|
tmpreg = READ_BIT(RCC->APBENR2, RCC_APBENR2_USART1EN);\
|
||||||
|
UNUSED(tmpreg); \
|
||||||
|
} while(0U)
|
||||||
|
|
||||||
|
#define __GPIOA_CLK_ENABLE() do { \
|
||||||
|
__IO uint32_t tmpreg = 0x00U; \
|
||||||
|
SET_BIT(RCC->IOPENR, RCC_IOPENR_GPIOAEN);\
|
||||||
|
/* Delay after an RCC peripheral clock enabling */ \
|
||||||
|
tmpreg = READ_BIT(RCC->IOPENR, RCC_IOPENR_GPIOAEN);\
|
||||||
|
UNUSED(tmpreg); \
|
||||||
|
} while(0U)
|
||||||
|
|
||||||
|
#define DEBUG_USART_RX_GPIO_PORT GPIOA
|
||||||
|
#define DEBUG_USART_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||||
|
#define DEBUG_USART_RX_PIN GPIO_PIN_3
|
||||||
|
#define DEBUG_USART_RX_AF GPIO_AF1_USART1
|
||||||
|
|
||||||
|
#define DEBUG_USART_TX_GPIO_PORT GPIOA
|
||||||
|
#define DEBUG_USART_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||||
|
#define DEBUG_USART_TX_PIN GPIO_PIN_2
|
||||||
|
#define DEBUG_USART_TX_AF GPIO_AF1_USART1
|
||||||
|
|
||||||
|
#define DEBUG_USART_IRQHandler USART1_IRQHandler
|
||||||
|
#define DEBUG_USART_IRQ USART1_IRQn
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern UART_HandleTypeDef DebugUartHandle;
|
extern UART_HandleTypeDef DebugUartHandle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
155
Libraries/LDScripts/py32f002x5.ld
Normal file
155
Libraries/LDScripts/py32f002x5.ld
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
**
|
||||||
|
** File : LinkerScript.ld
|
||||||
|
**
|
||||||
|
** Abstract : Linker script for PY32F003x6 series
|
||||||
|
** Set heap size, stack size and stack location according
|
||||||
|
** to application requirements.
|
||||||
|
** Set memory bank area and size if external memory is used.
|
||||||
|
**
|
||||||
|
** Distribution: The file is distributed “as is,” without any warranty
|
||||||
|
** of any kind.
|
||||||
|
**
|
||||||
|
*****************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Entry Point */
|
||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Highest address of the user mode stack */
|
||||||
|
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
|
||||||
|
/*
|
||||||
|
Generate a link error if heap and stack don't fit into RAM.
|
||||||
|
These numbers affect the USED size of RAM
|
||||||
|
*/
|
||||||
|
_Min_Heap_Size = 0x100; /* required amount of heap: 256 bytes */
|
||||||
|
_Min_Stack_Size = 0x200; /* required amount of stack: 512 bytes */
|
||||||
|
|
||||||
|
/* Specify the memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 3K
|
||||||
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 20K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define output sections */
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
/* The startup code goes first into FLASH */
|
||||||
|
.isr_vector :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* The program code and other data goes into FLASH */
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text) /* .text sections (code) */
|
||||||
|
*(.text*) /* .text* sections (code) */
|
||||||
|
*(.glue_7) /* glue arm to thumb code */
|
||||||
|
*(.glue_7t) /* glue thumb to arm code */
|
||||||
|
*(.eh_frame)
|
||||||
|
|
||||||
|
KEEP (*(.init))
|
||||||
|
KEEP (*(.fini))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .; /* define a global symbols at end of code */
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* Constant data goes into FLASH */
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||||
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||||
|
.ARM : {
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.preinit_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||||
|
KEEP (*(.preinit_array*))
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
.init_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__init_array_start = .);
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array*))
|
||||||
|
PROVIDE_HIDDEN (__init_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
.fini_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
KEEP (*(.fini_array*))
|
||||||
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* used by the startup to initialize data */
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = .; /* create a global symbol at data start */
|
||||||
|
*(.data) /* .data sections */
|
||||||
|
*(.data*) /* .data* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = .; /* define a global symbol at data end */
|
||||||
|
} >RAM AT> FLASH
|
||||||
|
|
||||||
|
|
||||||
|
/* Uninitialized data section */
|
||||||
|
. = ALIGN(4);
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
/* This is used by the startup in order to initialize the .bss secion */
|
||||||
|
_sbss = .; /* define a global symbol at bss start */
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = .; /* define a global symbol at bss end */
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} >RAM
|
||||||
|
|
||||||
|
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||||
|
._user_heap_stack :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
PROVIDE ( end = . );
|
||||||
|
PROVIDE ( _end = . );
|
||||||
|
. = . + _Min_Heap_Size;
|
||||||
|
. = . + _Min_Stack_Size;
|
||||||
|
. = ALIGN(8);
|
||||||
|
} >RAM
|
||||||
|
|
||||||
|
/* Remove information from the standard libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
|
||||||
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if (defined(PY32F003PRE)|| defined(PY32F030PRE) || defined(PY32F072PRE))
|
||||||
/**
|
/**
|
||||||
* @brief DMA Configuration Structure definition
|
* @brief DMA Configuration Structure definition
|
||||||
*/
|
*/
|
||||||
@ -471,7 +472,7 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma);
|
|||||||
#define IS_DMA_MAP_VALUE(VALUE) (VALUE < DMA_CHANNEL_MAP_END)
|
#define IS_DMA_MAP_VALUE(VALUE) (VALUE < DMA_CHANNEL_MAP_END)
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -95,6 +95,7 @@
|
|||||||
* @brief DMA HAL module driver
|
* @brief DMA HAL module driver
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#if (defined(PY32F003PRE)|| defined(PY32F030PRE) || defined(PY32F072PRE))
|
||||||
|
|
||||||
#ifdef HAL_DMA_MODULE_ENABLED
|
#ifdef HAL_DMA_MODULE_ENABLED
|
||||||
|
|
||||||
@ -883,6 +884,8 @@ static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -34,7 +34,7 @@ PYOCD_DEVICE ?= py32f003x8
|
|||||||
|
|
||||||
##### Paths ############
|
##### Paths ############
|
||||||
|
|
||||||
# Link descript file: py32f003x6.ld, py32f003x8.ld, py32f030x6.ld, py32f030x8.ld
|
# Link descript file: py32f002x5.ld, py32f003x6.ld, py32f003x8.ld, py32f030x6.ld, py32f030x8.ld
|
||||||
LDSCRIPT = Libraries/LDScripts/py32f003x8.ld
|
LDSCRIPT = Libraries/LDScripts/py32f003x8.ld
|
||||||
# Library build flags: PY32F002x5, PY32F002Ax5, PY32F003x4, PY32F003x6, PY32F003x8, PY32F030x3, PY32F030x4, PY32F030x6, PY32F030x7, PY32F030x8, PY32F072xB
|
# Library build flags: PY32F002x5, PY32F002Ax5, PY32F003x4, PY32F003x6, PY32F003x8, PY32F030x3, PY32F030x4, PY32F030x6, PY32F030x7, PY32F030x8, PY32F072xB
|
||||||
LIB_FLAGS = PY32F003x8
|
LIB_FLAGS = PY32F003x8
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user