This commit is contained in:
thomas committed 2026-10-18 14:06:40 +02:00
commit 2c2202e60d
2491 files changed
+1295990

No files matched your search

BIN
View File
Binary file not shown.
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
makefile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
makefile_dir := $(dir $(makefile_path))
.PHONY: all clean assets flash intflash
all clean assets flash intflash:
$(MAKE) -C $(makefile_dir) --no-print-directory -f makefile_boot $(MAKEFLAGS) $@
$(MAKE) -C $(makefile_dir) --no-print-directory -f makefile_appli $(MAKEFLAGS) $@
@@ -0,0 +1,775 @@
/*
* FreeRTOS Kernel V10.3.1
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/*-----------------------------------------------------------
* Implementation of functions defined in portable.h for the ARM CM4F port.
*----------------------------------------------------------*/
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
#ifndef __VFP_FP__
#error This port can only be used when the project options are configured to enable hardware floating point support.
#endif
#ifndef configSYSTICK_CLOCK_HZ
#define configSYSTICK_CLOCK_HZ configCPU_CLOCK_HZ
/* Ensure the SysTick is clocked at the same frequency as the core. */
#define portNVIC_SYSTICK_CLK_BIT ( 1UL << 2UL )
#else
/* The way the SysTick is clocked is not modified in case it is not the same
as the core. */
#define portNVIC_SYSTICK_CLK_BIT ( 0 )
#endif
/* Constants required to manipulate the core. Registers first... */
#define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000e010 ) )
#define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile uint32_t * ) 0xe000e014 ) )
#define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile uint32_t * ) 0xe000e018 ) )
#define portNVIC_SYSPRI2_REG ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )
/* ...then bits in the registers. */
#define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL )
#define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL )
#define portNVIC_SYSTICK_COUNT_FLAG_BIT ( 1UL << 16UL )
#define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
/* Constants used to detect a Cortex-M7 r0p1 core, which should use the ARM_CM7
r0p1 port. */
#define portCPUID ( * ( ( volatile uint32_t * ) 0xE000ed00 ) )
#define portCORTEX_M7_r0p1_ID ( 0x410FC271UL )
#define portCORTEX_M7_r0p0_ID ( 0x410FC270UL )
#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
/* Constants required to check the validity of an interrupt priority. */
#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
#define portNVIC_IP_REGISTERS_OFFSET_16 ( 0xE000E3F0 )
#define portAIRCR_REG ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )
#define portMAX_8_BIT_VALUE ( ( uint8_t ) 0xff )
#define portTOP_BIT_OF_BYTE ( ( uint8_t ) 0x80 )
#define portMAX_PRIGROUP_BITS ( ( uint8_t ) 7 )
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
#define portPRIGROUP_SHIFT ( 8UL )
/* Masks off all bits but the VECTACTIVE bits in the ICSR register. */
#define portVECTACTIVE_MASK ( 0xFFUL )
/* Constants required to manipulate the VFP. */
#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34 ) /* Floating point context control register. */
#define portASPEN_AND_LSPEN_BITS ( 0x3UL << 30UL )
/* Constants required to set up the initial stack. */
#define portINITIAL_XPSR ( 0x01000000 )
#define portINITIAL_EXC_RETURN ( 0xfffffffd )
/* The systick is a 24-bit counter. */
#define portMAX_24_BIT_NUMBER ( 0xffffffUL )
/* For strict compliance with the Cortex-M spec the task start address should
have bit-0 clear, as it is loaded into the PC on exit from an ISR. */
#define portSTART_ADDRESS_MASK ( ( StackType_t ) 0xfffffffeUL )
/* A fiddle factor to estimate the number of SysTick counts that would have
occurred while the SysTick counter is stopped during tickless idle
calculations. */
#define portMISSED_COUNTS_FACTOR ( 45UL )
/* Let the user override the pre-loading of the initial LR with the address of
prvTaskExitError() in case it messes up unwinding of the stack in the
debugger. */
#ifdef configTASK_RETURN_ADDRESS
#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
#else
#define portTASK_RETURN_ADDRESS prvTaskExitError
#endif
/*
* Setup the timer to generate the tick interrupts. The implementation in this
* file is weak to allow application writers to change the timer used to
* generate the tick interrupt.
*/
void vPortSetupTimerInterrupt( void );
/*
* Exception handlers.
*/
void xPortPendSVHandler( void ) __attribute__ (( naked ));
void xPortSysTickHandler( void );
void vPortSVCHandler( void ) __attribute__ (( naked ));
/*
* Start first task is a separate function so it can be tested in isolation.
*/
static void prvPortStartFirstTask( void ) __attribute__ (( naked ));
/*
* Function to enable the VFP.
*/
static void vPortEnableVFP( void ) __attribute__ (( naked ));
/*
* Used to catch tasks that attempt to return from their implementing function.
*/
static void prvTaskExitError( void );
/*-----------------------------------------------------------*/
/* Each task maintains its own interrupt status in the critical nesting
variable. */
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
/*
* The number of SysTick increments that make up one tick period.
*/
#if( configUSE_TICKLESS_IDLE == 1 )
static uint32_t ulTimerCountsForOneTick = 0;
#endif /* configUSE_TICKLESS_IDLE */
/*
* The maximum number of tick periods that can be suppressed is limited by the
* 24 bit resolution of the SysTick timer.
*/
#if( configUSE_TICKLESS_IDLE == 1 )
static uint32_t xMaximumPossibleSuppressedTicks = 0;
#endif /* configUSE_TICKLESS_IDLE */
/*
* Compensate for the CPU cycles that pass while the SysTick is stopped (low
* power functionality only.
*/
#if( configUSE_TICKLESS_IDLE == 1 )
static uint32_t ulStoppedTimerCompensation = 0;
#endif /* configUSE_TICKLESS_IDLE */
/*
* Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure
* FreeRTOS API functions are not called from interrupts that have been assigned
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
*/
#if( configASSERT_DEFINED == 1 )
static uint8_t ucMaxSysCallPriority = 0;
static uint32_t ulMaxPRIGROUPValue = 0;
static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;
#endif /* configASSERT_DEFINED */
/*-----------------------------------------------------------*/
/*
* See header file for description.
*/
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
/* Simulate the stack frame as it would be created by a context switch
interrupt. */
/* Offset added to account for the way the MCU uses the stack on entry/exit
of interrupts, and to ensure alignment. */
pxTopOfStack--;
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
pxTopOfStack--;
*pxTopOfStack = ( ( StackType_t ) pxCode ) & portSTART_ADDRESS_MASK; /* PC */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
/* Save code space by skipping register initialisation. */
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
/* A save method is being used that requires each task to maintain its
own exec return value. */
pxTopOfStack--;
*pxTopOfStack = portINITIAL_EXC_RETURN;
pxTopOfStack -= 8; /* R11, R10, R9, R8, R7, R6, R5 and R4. */
return pxTopOfStack;
}
/*-----------------------------------------------------------*/
static void prvTaskExitError( void )
{
volatile uint32_t ulDummy = 0;
/* A function that implements a task must not exit or attempt to return to
its caller as there is nothing to return to. If a task wants to exit it
should instead call vTaskDelete( NULL ).
Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error. */
configASSERT( uxCriticalNesting == ~0UL );
portDISABLE_INTERRUPTS();
while( ulDummy == 0 )
{
/* This file calls prvTaskExitError() after the scheduler has been
started to remove a compiler warning about the function being defined
but never called. ulDummy is used purely to quieten other warnings
about code appearing after this function is called - making ulDummy
volatile makes the compiler think the function could return and
therefore not output an 'unreachable code' warning for code that appears
after it. */
}
}
/*-----------------------------------------------------------*/
void vPortSVCHandler( void )
{
__asm volatile (
" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
" ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
" ldmia r0!, {r4-r11, r14} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
" msr psp, r0 \n" /* Restore the task stack pointer. */
" isb \n"
" mov r0, #0 \n"
" msr basepri, r0 \n"
" bx r14 \n"
" \n"
" .align 4 \n"
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
);
}
/*-----------------------------------------------------------*/
static void prvPortStartFirstTask( void )
{
/* Start the first task. This also clears the bit that indicates the FPU is
in use in case the FPU was used before the scheduler was started - which
would otherwise result in the unnecessary leaving of space in the SVC stack
for lazy saving of FPU registers. */
__asm volatile(
" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
" ldr r0, [r0] \n"
" ldr r0, [r0] \n"
" msr msp, r0 \n" /* Set the msp back to the start of the stack. */
" mov r0, #0 \n" /* Clear the bit that indicates the FPU is in use, see comment above. */
" msr control, r0 \n"
" cpsie i \n" /* Globally enable interrupts. */
" cpsie f \n"
" dsb \n"
" isb \n"
" svc 0 \n" /* System call to start first task. */
" nop \n"
);
}
/*-----------------------------------------------------------*/
/*
* See header file for description.
*/
BaseType_t xPortStartScheduler( void )
{
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
configASSERT( configMAX_SYSCALL_INTERRUPT_PRIORITY );
/* This port can be used on all revisions of the Cortex-M7 core other than
the r0p1 parts. r0p1 parts should use the port from the
/source/portable/GCC/ARM_CM7/r0p1 directory. */
configASSERT( portCPUID != portCORTEX_M7_r0p1_ID );
configASSERT( portCPUID != portCORTEX_M7_r0p0_ID );
#if( configASSERT_DEFINED == 1 )
{
volatile uint32_t ulOriginalPriority;
volatile uint8_t * const pucFirstUserPriorityRegister = ( volatile uint8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );
volatile uint8_t ucMaxPriorityValue;
/* Determine the maximum priority from which ISR safe FreeRTOS API
functions can be called. ISR safe functions are those that end in
"FromISR". FreeRTOS maintains separate thread and ISR API functions to
ensure interrupt entry is as fast and simple as possible.
Save the interrupt priority value that is about to be clobbered. */
ulOriginalPriority = *pucFirstUserPriorityRegister;
/* Determine the number of priority bits available. First write to all
possible bits. */
*pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE;
/* Read the value back to see how many bits stuck. */
ucMaxPriorityValue = *pucFirstUserPriorityRegister;
/* Use the same mask on the maximum system call priority. */
ucMaxSysCallPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue;
/* Calculate the maximum acceptable priority group value for the number
of bits read back. */
ulMaxPRIGROUPValue = portMAX_PRIGROUP_BITS;
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
{
ulMaxPRIGROUPValue--;
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
}
#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
priority bits matches the number of priority bits actually queried
from the hardware. */
configASSERT( ( portMAX_PRIGROUP_BITS - ulMaxPRIGROUPValue ) == __NVIC_PRIO_BITS );
}
#endif
#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
priority bits matches the number of priority bits actually queried
from the hardware. */
configASSERT( ( portMAX_PRIGROUP_BITS - ulMaxPRIGROUPValue ) == configPRIO_BITS );
}
#endif
/* Shift the priority group value back to its position within the AIRCR
register. */
ulMaxPRIGROUPValue <<= portPRIGROUP_SHIFT;
ulMaxPRIGROUPValue &= portPRIORITY_GROUP_MASK;
/* Restore the clobbered interrupt priority register to its original
value. */
*pucFirstUserPriorityRegister = ulOriginalPriority;
}
#endif /* conifgASSERT_DEFINED */
/* Make PendSV and SysTick the lowest priority interrupts. */
portNVIC_SYSPRI2_REG |= portNVIC_PENDSV_PRI;
portNVIC_SYSPRI2_REG |= portNVIC_SYSTICK_PRI;
/* Start the timer that generates the tick ISR. Interrupts are disabled
here already. */
vPortSetupTimerInterrupt();
/* Initialise the critical nesting count ready for the first task. */
uxCriticalNesting = 0;
/* Ensure the VFP is enabled - it should be anyway. */
vPortEnableVFP();
/* Lazy save always. */
*( portFPCCR ) |= portASPEN_AND_LSPEN_BITS;
/* Start the first task. */
prvPortStartFirstTask();
/* Should never get here as the tasks will now be executing! Call the task
exit error function to prevent compiler warnings about a static function
not being called in the case that the application writer overrides this
functionality by defining configTASK_RETURN_ADDRESS. Call
vTaskSwitchContext() so link time optimisation does not remove the
symbol. */
vTaskSwitchContext();
prvTaskExitError();
/* Should not get here! */
return 0;
}
/*-----------------------------------------------------------*/
void vPortEndScheduler( void )
{
/* Not implemented in ports where there is nothing to return to.
Artificially force an assert. */
configASSERT( uxCriticalNesting == 1000UL );
}
/*-----------------------------------------------------------*/
void vPortEnterCritical( void )
{
portDISABLE_INTERRUPTS();
uxCriticalNesting++;
/* This is not the interrupt safe version of the enter critical function so
assert() if it is being called from an interrupt context. Only API
functions that end in "FromISR" can be used in an interrupt. Only assert if
the critical nesting count is 1 to protect against recursive calls if the
assert function also uses a critical section. */
if( uxCriticalNesting == 1 )
{
configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
}
}
/*-----------------------------------------------------------*/
void vPortExitCritical( void )
{
configASSERT( uxCriticalNesting );
uxCriticalNesting--;
if( uxCriticalNesting == 0 )
{
portENABLE_INTERRUPTS();
}
}
/*-----------------------------------------------------------*/
void xPortPendSVHandler( void )
{
/* This is a naked function. */
__asm volatile
(
" mrs r0, psp \n"
" isb \n"
" \n"
" ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
" ldr r2, [r3] \n"
" \n"
" tst r14, #0x10 \n" /* Is the task using the FPU context? If so, push high vfp registers. */
" it eq \n"
" vstmdbeq r0!, {s16-s31} \n"
" \n"
" stmdb r0!, {r4-r11, r14} \n" /* Save the core registers. */
" str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */
" \n"
" stmdb sp!, {r0, r3} \n"
" mov r0, %0 \n"
" msr basepri, r0 \n"
" dsb \n"
" isb \n"
" bl vTaskSwitchContext \n"
" mov r0, #0 \n"
" msr basepri, r0 \n"
" ldmia sp!, {r0, r3} \n"
" \n"
" ldr r1, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */
" ldr r0, [r1] \n"
" \n"
" ldmia r0!, {r4-r11, r14} \n" /* Pop the core registers. */
" \n"
" tst r14, #0x10 \n" /* Is the task using the FPU context? If so, pop the high vfp registers too. */
" it eq \n"
" vldmiaeq r0!, {s16-s31} \n"
" \n"
" msr psp, r0 \n"
" isb \n"
" \n"
#ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata workaround. */
#if WORKAROUND_PMU_CM001 == 1
" push { r14 } \n"
" pop { pc } \n"
#endif
#endif
" \n"
" bx r14 \n"
" \n"
" .align 4 \n"
"pxCurrentTCBConst: .word pxCurrentTCB \n"
::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY)
);
}
/*-----------------------------------------------------------*/
void xPortSysTickHandler( void )
{
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
}
portENABLE_INTERRUPTS();
}
/*-----------------------------------------------------------*/
#if( configUSE_TICKLESS_IDLE == 1 )
__attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
{
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements;
TickType_t xModifiableIdleTime;
/* Make sure the SysTick reload value does not overflow the counter. */
if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )
{
xExpectedIdleTime = xMaximumPossibleSuppressedTicks;
}
/* Stop the SysTick momentarily. The time the SysTick is stopped for
is accounted for as best it can be, but using the tickless mode will
inevitably result in some tiny drift of the time maintained by the
kernel with respect to calendar time. */
portNVIC_SYSTICK_CTRL_REG &= ~portNVIC_SYSTICK_ENABLE_BIT;
/* Calculate the reload value required to wait xExpectedIdleTime
tick periods. -1 is used because this code will execute part way
through one of the tick periods. */
ulReloadValue = portNVIC_SYSTICK_CURRENT_VALUE_REG + ( ulTimerCountsForOneTick * ( xExpectedIdleTime - 1UL ) );
if( ulReloadValue > ulStoppedTimerCompensation )
{
ulReloadValue -= ulStoppedTimerCompensation;
}
/* Enter a critical section but don't use the taskENTER_CRITICAL()
method as that will mask interrupts that should exit sleep mode. */
__asm volatile( "cpsid i" ::: "memory" );
__asm volatile( "dsb" );
__asm volatile( "isb" );
/* If a context switch is pending or a task is waiting for the scheduler
to be unsuspended then abandon the low power entry. */
if( eTaskConfirmSleepModeStatus() == eAbortSleep )
{
/* Restart from whatever is left in the count register to complete
this tick period. */
portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG;
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG |= portNVIC_SYSTICK_ENABLE_BIT;
/* Reset the reload register to the value required for normal tick
periods. */
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;
/* Re-enable interrupts - see comments above the cpsid instruction()
above. */
__asm volatile( "cpsie i" ::: "memory" );
}
else
{
/* Set the new reload value. */
portNVIC_SYSTICK_LOAD_REG = ulReloadValue;
/* Clear the SysTick count flag and set the count value back to
zero. */
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;
/* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG |= portNVIC_SYSTICK_ENABLE_BIT;
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__asm volatile( "dsb" ::: "memory" );
__asm volatile( "wfi" );
__asm volatile( "isb" );
}
configPOST_SLEEP_PROCESSING( xExpectedIdleTime );
/* Re-enable interrupts to allow the interrupt that brought the MCU
out of sleep mode to execute immediately. see comments above
__disable_interrupt() call above. */
__asm volatile( "cpsie i" ::: "memory" );
__asm volatile( "dsb" );
__asm volatile( "isb" );
/* Disable interrupts again because the clock is about to be stopped
and interrupts that execute while the clock is stopped will increase
any slippage between the time maintained by the RTOS and calendar
time. */
__asm volatile( "cpsid i" ::: "memory" );
__asm volatile( "dsb" );
__asm volatile( "isb" );
/* Disable the SysTick clock without reading the
portNVIC_SYSTICK_CTRL_REG register to ensure the
portNVIC_SYSTICK_COUNT_FLAG_BIT is not cleared if it is set. Again,
the time the SysTick is stopped for is accounted for as best it can
be, but using the tickless mode will inevitably result in some tiny
drift of the time maintained by the kernel with respect to calendar
time*/
portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT );
/* Determine if the SysTick clock has already counted to zero and
been set back to the current reload value (the reload back being
correct for the entire expected idle time) or if the SysTick is yet
to count to zero (in which case an interrupt other than the SysTick
must have brought the system out of sleep mode). */
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
{
uint32_t ulCalculatedLoadValue;
/* The tick interrupt is already pending, and the SysTick count
reloaded with ulReloadValue. Reset the
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick
period. */
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );
/* Don't allow a tiny value, or values that have somehow
underflowed because the post sleep hook did something
that took too long. */
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )
{
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );
}
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;
/* As the pending tick will be processed as soon as this
function exits, the tick value maintained by the tick is stepped
forward by one less than the time spent waiting. */
ulCompleteTickPeriods = xExpectedIdleTime - 1UL;
}
else
{
/* Something other than the tick interrupt ended the sleep.
Work out how long the sleep lasted rounded to complete tick
periods (not the ulReload value which accounted for part
ticks). */
ulCompletedSysTickDecrements = ( xExpectedIdleTime * ulTimerCountsForOneTick ) - portNVIC_SYSTICK_CURRENT_VALUE_REG;
/* How many complete tick periods passed while the processor
was waiting? */
ulCompleteTickPeriods = ulCompletedSysTickDecrements / ulTimerCountsForOneTick;
/* The reload value is set to whatever fraction of a single tick
period remains. */
portNVIC_SYSTICK_LOAD_REG = ( ( ulCompleteTickPeriods + 1UL ) * ulTimerCountsForOneTick ) - ulCompletedSysTickDecrements;
}
/* Restart SysTick so it runs from portNVIC_SYSTICK_LOAD_REG
again, then set portNVIC_SYSTICK_LOAD_REG back to its standard
value. */
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;
portNVIC_SYSTICK_CTRL_REG |= portNVIC_SYSTICK_ENABLE_BIT;
vTaskStepTick( ulCompleteTickPeriods );
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;
/* Exit with interrupts enabled. */
__asm volatile( "cpsie i" ::: "memory" );
}
}
#endif /* #if configUSE_TICKLESS_IDLE */
/*-----------------------------------------------------------*/
/*
* Setup the systick timer to generate the tick interrupts at the required
* frequency.
*/
__attribute__(( weak )) void vPortSetupTimerInterrupt( void )
{
/* Calculate the constants required to configure the tick interrupt. */
#if( configUSE_TICKLESS_IDLE == 1 )
{
ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ );
xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;
ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );
}
#endif /* configUSE_TICKLESS_IDLE */
/* Stop and clear the SysTick. */
portNVIC_SYSTICK_CTRL_REG = 0UL;
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;
/* Configure SysTick to interrupt at the requested rate. */
portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;
portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT );
}
/*-----------------------------------------------------------*/
/* This is a naked function. */
static void vPortEnableVFP( void )
{
__asm volatile
(
" ldr.w r0, =0xE000ED88 \n" /* The FPU enable bits are in the CPACR. */
" ldr r1, [r0] \n"
" \n"
" orr r1, r1, #( 0xf << 20 ) \n" /* Enable CP10 and CP11 coprocessors, then save back. */
" str r1, [r0] \n"
" bx r14 "
);
}
/*-----------------------------------------------------------*/
#if( configASSERT_DEFINED == 1 )
void vPortValidateInterruptPriority( void )
{
uint32_t ulCurrentInterrupt;
uint8_t ucCurrentPriority;
/* Obtain the number of the currently executing interrupt. */
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
/* Is the interrupt number a user defined interrupt? */
if( ulCurrentInterrupt >= portFIRST_USER_INTERRUPT_NUMBER )
{
/* Look up the interrupt's priority. */
ucCurrentPriority = pcInterruptPriorityRegisters[ ulCurrentInterrupt ];
/* The following assertion will fail if a service routine (ISR) for
an interrupt that has been assigned a priority above
configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API
function. ISR safe FreeRTOS API functions must *only* be called
from interrupts that have been assigned a priority at or below
configMAX_SYSCALL_INTERRUPT_PRIORITY.
Numerically low interrupt priority numbers represent logically high
interrupt priorities, therefore the priority of the interrupt must
be set to a value equal to or numerically *higher* than
configMAX_SYSCALL_INTERRUPT_PRIORITY.
Interrupts that use the FreeRTOS API must not be left at their
default priority of zero as that is the highest possible priority,
which is guaranteed to be above configMAX_SYSCALL_INTERRUPT_PRIORITY,
and therefore also guaranteed to be invalid.
FreeRTOS maintains separate thread and ISR API functions to ensure
interrupt entry is as fast and simple as possible.
The following links provide detailed information:
http://www.freertos.org/RTOS-Cortex-M3-M4.html
http://www.freertos.org/FAQHelp.html */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
}
/* Priority grouping: The interrupt controller (NVIC) allows the bits
that define each interrupt's priority to be split between bits that
define the interrupt's pre-emption priority bits and bits that define
the interrupt's sub-priority. For simplicity all bits must be defined
to be pre-emption priority bits. The following assertion will fail if
this is not the case (if some bits represent a sub-priority).
If the application only uses CMSIS libraries for interrupt
configuration then the correct setting can be achieved on all Cortex-M
devices by calling NVIC_SetPriorityGrouping( 0 ); before starting the
scheduler. Note however that some vendor specific peripheral libraries
assume a non-zero priority group setting, in which cases using a value
of zero will result in unpredictable behaviour. */
configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );
}
#endif /* configASSERT_DEFINED */
@@ -0,0 +1,243 @@
/*
* FreeRTOS Kernel V10.3.1
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef PORTMACRO_H
#define PORTMACRO_H
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------
* Port specific definitions.
*
* The settings in this file configure FreeRTOS correctly for the
* given hardware and compiler.
*
* These settings should not be altered.
*-----------------------------------------------------------
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE uint32_t
#define portBASE_TYPE long
typedef portSTACK_TYPE StackType_t;
typedef long BaseType_t;
typedef unsigned long UBaseType_t;
#if( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffff
#else
typedef uint32_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
#endif
/*-----------------------------------------------------------*/
/* Architecture specifics. */
#define portSTACK_GROWTH ( -1 )
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
#define portBYTE_ALIGNMENT 8
/*-----------------------------------------------------------*/
/* Scheduler utilities. */
#define portYIELD() \
{ \
/* Set a PendSV to request a context switch. */ \
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
\
/* Barriers are normally not required but do ensure the code is completely \
within the specified behaviour for the architecture. */ \
__asm volatile( "dsb" ::: "memory" ); \
__asm volatile( "isb" ); \
}
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
/* Critical section management. */
extern void vPortEnterCritical( void );
extern void vPortExitCritical( void );
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortRaiseBASEPRI()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortSetBASEPRI(x)
#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
#define portENABLE_INTERRUPTS() vPortSetBASEPRI(0)
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
/*-----------------------------------------------------------*/
/* Task function macros as described on the FreeRTOS.org WEB site. These are
not necessary for to use this port. They are defined so the common demo files
(which build with all the ports) will build. */
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
/*-----------------------------------------------------------*/
/* Tickless idle/low power functionality. */
#ifndef portSUPPRESS_TICKS_AND_SLEEP
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
#endif
/*-----------------------------------------------------------*/
/* Architecture specific optimisations. */
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#endif
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
/* Generic helper function. */
__attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
{
uint8_t ucReturn;
__asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) : "memory" );
return ucReturn;
}
/* Check the configuration. */
#if( configMAX_PRIORITIES > 32 )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
#endif
/* Store/clear the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
/*-----------------------------------------------------------*/
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
/*-----------------------------------------------------------*/
#ifdef configASSERT
void vPortValidateInterruptPriority( void );
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
#endif
/* portNOP() is not required by this port. */
#define portNOP()
#define portINLINE __inline
#ifndef portFORCE_INLINE
#define portFORCE_INLINE inline __attribute__(( always_inline))
#endif
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
{
uint32_t ulCurrentInterrupt;
BaseType_t xReturn;
/* Obtain the number of the currently executing interrupt. */
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) :: "memory" );
if( ulCurrentInterrupt == 0 )
{
xReturn = pdFALSE;
}
else
{
xReturn = pdTRUE;
}
return xReturn;
}
/*-----------------------------------------------------------*/
portFORCE_INLINE static void vPortRaiseBASEPRI( void )
{
uint32_t ulNewBASEPRI;
__asm volatile
(
" mov %0, %1 \n" \
" msr basepri, %0 \n" \
" isb \n" \
" dsb \n" \
:"=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
);
}
/*-----------------------------------------------------------*/
portFORCE_INLINE static uint32_t ulPortRaiseBASEPRI( void )
{
uint32_t ulOriginalBASEPRI, ulNewBASEPRI;
__asm volatile
(
" mrs %0, basepri \n" \
" mov %1, %2 \n" \
" msr basepri, %1 \n" \
" isb \n" \
" dsb \n" \
:"=r" (ulOriginalBASEPRI), "=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
);
/* This return will not be reached but is necessary to prevent compiler
warnings. */
return ulOriginalBASEPRI;
}
/*-----------------------------------------------------------*/
portFORCE_INLINE static void vPortSetBASEPRI( uint32_t ulNewMaskValue )
{
__asm volatile
(
" msr basepri, %0 " :: "r" ( ulNewMaskValue ) : "memory"
);
}
/*-----------------------------------------------------------*/
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
#ifdef __cplusplus
}
#endif
#endif /* PORTMACRO_H */
+38
View File
@@ -0,0 +1,38 @@
stm32cube_programmer_path := STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
stm32cube_programmer_filename := STM32_Programmer_CLI.exe
stm32cube_programmer_filepath := $(stm32cube_programmer_path)/$(stm32cube_programmer_filename)
stm32cube_loader_relative_path := ExternalLoader/$(stldr)
stm32cube_loader := $(stm32cube_programmer_path)/$(stm32cube_loader_relative_path)
program_files_win32 = /c/Program Files (x86)
program_files_win64 = /c/Program Files
program_files_CLT = /c/ST/STM32CubeCLT/STM32CubeCLT/
# Check which tools are installed
ifneq ("$(shell find "$(program_files_win64)/$(stm32cube_programmer_filepath)" 2> nul )","")
program_files_path := $(program_files_win64)
else ifneq ("$(shell find "$(program_files_win32)/$(stm32cube_programmer_filepath)" 2> nul )","")
program_files_path := $(program_files_win32)
else ifneq ("$(shell find "$(program_files_CLT)/$(stm32cube_programmer_filepath)" 2> nul )","")
program_files_path := $(program_files_CLT)
endif
st_stm32cube_programmer_path := $(program_files_path)/$(stm32cube_programmer_path)
st_stm32cube_programmer_filepath := $(program_files_path)/$(stm32cube_programmer_filepath)
st_stm32cube_external_loader := $(program_files_path)/$(stm32cube_loader)
# define variable n as some line breaks for the error message
define error_msg
****************************************************************************************************************************
* *
* STM32CubeProgrammer is not found. Make sure the STM32CubeProgrammer is installed in its default directory. *
* You can download it at https://www.st.com/en/development-tools/stm32cubeprog.html *
* *
****************************************************************************************************************************
endef
+10
View File
@@ -0,0 +1,10 @@
_extflash_:
ifeq ($(program_files_path),)
$(error $(error_msg))
endif
@cd "$(st_stm32cube_programmer_path)" && ./$(stm32cube_programmer_filename) -c port=SWD ap=1 -d $(application_path)/$(binary_output_path)/target.hex -el $(stm32cube_loader_relative_path) -hardRst
_intflash_:
ifeq ($(program_files_path),)
$(error $(error_msg))
endif
@cd "$(st_stm32cube_programmer_path)" && ./$(stm32cube_programmer_filename) -c port=SWD ap=1 -d $(application_path)/$(binary_output_path)/intflash.hex -el $(stm32cube_loader_relative_path) -hardRst
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Lance le fontconvert.out Windows du projet via le Wine embarqué dans TouchGFX.app
# (TouchGFX Designer pour macOS est une appli Wineskin - c'est le meme mecanisme que ST utilise).
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
WINE64="/Applications/STMicroelectronics/TouchGFX.app/Contents/SharedSupport/wine/bin/wine64"
TOOL="$PROJECT_ROOT/Appli/Middlewares/ST/touchgfx/framework/tools/fontconvert/build/win/fontconvert.out"
if [ ! -x "$WINE64" ]; then
echo "Wine introuvable ($WINE64). TouchGFX.app (Designer) doit etre installe dans /Applications/STMicroelectronics." >&2
exit 1
fi
export DYLD_FALLBACK_LIBRARY_PATH="/Applications/STMicroelectronics/TouchGFX.app/Contents/Frameworks:/Applications/STMicroelectronics/TouchGFX.app/Contents/SharedSupport/wine/lib"
"$WINE64" "$TOOL" "$@" 2>/dev/null
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Lance l'imageconvert.out Windows du projet via le Wine embarqué dans TouchGFX.app
# (TouchGFX Designer pour macOS est une appli Wineskin - c'est le meme mecanisme que ST utilise).
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
WINE64="/Applications/STMicroelectronics/TouchGFX.app/Contents/SharedSupport/wine/bin/wine64"
TOOL="$PROJECT_ROOT/Appli/Middlewares/ST/touchgfx/framework/tools/imageconvert/build/win/imageconvert.out"
if [ ! -x "$WINE64" ]; then
echo "Wine introuvable ($WINE64). TouchGFX.app (Designer) doit etre installe dans /Applications/STMicroelectronics." >&2
exit 1
fi
export DYLD_FALLBACK_LIBRARY_PATH="/Applications/STMicroelectronics/TouchGFX.app/Contents/Frameworks:/Applications/STMicroelectronics/TouchGFX.app/Contents/SharedSupport/wine/lib"
"$WINE64" "$TOOL" "$@" 2>/dev/null
+513
View File
@@ -0,0 +1,513 @@
# Helper macros to convert spaces into question marks and back again
e :=
sp := $(e) $(e)
qs = $(subst ?,$(sp),$1)
sq = $(subst $(sp),?,$1)
# Get name of this Makefile (avoid getting word 0 and a starting space)
makefile_name := $(wordlist 1,1000,$(MAKEFILE_LIST))
# Get path of this Makefile
makefile_path := $(call qs,$(dir $(call sq,$(abspath $(call sq,$(makefile_name))))))
# Get path where the Application is
application_path := $(call qs,$(abspath $(call sq,$(makefile_path)..)))
# Change makefile_name to a relative path
makefile_name := $(subst $(call sq,$(application_path))/,,$(call sq,$(abspath $(call sq,$(makefile_name)))))
# Get relative path to makefile from application_path
makefile_path_relative := $(subst $(call sq,$(application_path))/,,$(call sq,$(abspath $(call sq,$(makefile_path)))))
# Get path to Middlewares
touchgfx_middlewares_path := gcc/Middlewares
cubemx_middlewares_path := Middlewares
# Get path to Drivers
Drivers_path := Drivers
# Get path to GPU2D
gpu2d_path := Appli/Middlewares/ST/touchgfx_components/gpu2d
# Get OS path
touchgfx_os_path := $(touchgfx_middlewares_path)/Third_Party/FreeRTOS
cubemx_os_path := $(cubemx_middlewares_path)/Third_Party/FreeRTOS
# Get identification of this system
ifeq ($(OS),Windows_NT)
UNAME := MINGW32_NT-6.2
else
UNAME := $(shell uname -s)
endif
board_name := STM32H7S78-DK
platform := cortex_m7
cpp_compiler_options_local :=
c_compiler_options_local :=
.PHONY: all clean assets flash intflash
all: $(filter clean,$(MAKECMDGOALS))
all clean assets:
@cd "$(application_path)" && $(MAKE) -r -f $(makefile_name) -s $(MFLAGS) _$@_
flash intflash: all
@cd "$(application_path)" && $(MAKE) -r -f $(makefile_name) -s $(MFLAGS) _$@_
# Directories containing application-specific source and header files.
# Additional components can be added to this list. make will look for
# source files recursively in comp_name/src and setup an include directive
# for comp_name/include.
components := \
Appli/TouchGFX/gui \
Appli/TouchGFX/generated/gui_generated
touchgfx_generator_components := \
Appli/TouchGFX/target \
Appli/TouchGFX/App
# Location of folder containing bmp/png files.
asset_images_input := Appli/TouchGFX/assets/images
# Location of folder to search for ttf font files
asset_fonts_input := Appli/TouchGFX/assets/fonts
# Location of folder where the texts.xml is placed
asset_texts_input := Appli/TouchGFX/assets/texts
# Location of folder where the video.avi is placed
asset_videos_input := Appli/TouchGFX/assets/videos
build_root_path := Appli/TouchGFX/build
object_output_path := $(build_root_path)/$(board_name)
binary_output_path := $(build_root_path)/bin
# Location of output folders where autogenerated code from assets is placed
asset_root_path := Appli/TouchGFX/generated
asset_images_output := $(asset_root_path)/images
asset_fonts_output := $(asset_root_path)/fonts
asset_texts_output := $(asset_root_path)/texts
asset_videos_output := $(asset_root_path)/videos
#include application specific configuration
include $(application_path)/Appli/TouchGFX/config/gcc/app.mk
# corrects TouchGFX Path
touchgfx_path := Appli/${subst ../,,$(touchgfx_path)}
os_source_files := \
$(cubemx_os_path)/Source/croutine.c \
$(cubemx_os_path)/Source/event_groups.c \
$(cubemx_os_path)/Source/list.c \
$(cubemx_os_path)/Source/queue.c \
$(cubemx_os_path)/Source/stream_buffer.c \
$(cubemx_os_path)/Source/tasks.c \
$(cubemx_os_path)/Source/timers.c \
$(cubemx_os_path)/Source/CMSIS_RTOS_V2/cmsis_os2.c
os_include_paths := \
$(cubemx_os_path)/Source/include \
$(cubemx_os_path)/Source/CMSIS_RTOS_V2 \
$(touchgfx_os_path)/Source/portable/GCC/ARM_CM4F
# these paths can be moved to the touchgfx portable dirs in the future
os_source_files += \
$(cubemx_os_path)/Source/portable/MemMang/heap_4.c \
$(cubemx_os_path)/Source/portable/Common/mpu_wrappers.c \
$(touchgfx_os_path)/Source/portable/GCC/ARM_CM4F/port.c
ifeq ($(UNAME), Linux)
imageconvert_executable := $(touchgfx_path)/framework/tools/imageconvert/build/linux/imageconvert.out
fontconvert_executable := $(touchgfx_path)/framework/tools/fontconvert/build/linux/fontconvert.out
else ifeq ($(UNAME), Darwin)
# Pas de binaire macOS pour imageconvert/fontconvert (Windows/Linux only) : on passe par le
# Wine embarque dans TouchGFX.app (TouchGFX Designer pour macOS est une appli Wineskin).
imageconvert_executable := gcc/macos_wine_wrappers/imageconvert.sh
fontconvert_executable := gcc/macos_wine_wrappers/fontconvert.sh
else
imageconvert_executable := $(touchgfx_path)/framework/tools/imageconvert/build/win/imageconvert.out
fontconvert_executable := $(touchgfx_path)/framework/tools/fontconvert/build/win/fontconvert.out
stldr := MX66UW1G45G_STM32H7S78-DK.stldr
include $(application_path)/gcc/include/cube_programmer.mk
endif
target_executable := target.elf
target_hex := target.hex
assembler := arm-none-eabi-gcc
c_compiler := arm-none-eabi-gcc
cpp_compiler := arm-none-eabi-g++
linker := arm-none-eabi-g++
objcopy := arm-none-eabi-objcopy
archiver := arm-none-eabi-ar
strip := arm-none-eabi-strip
assembler_options += \
-Wall \
-fno-exceptions \
-g3 \
-mthumb \
-MMD \
-MP \
-c \
-x assembler-with-cpp
c_compiler_options += \
--specs=nano.specs \
-MMD \
-MP \
-Os \
-Wall \
-fdata-sections \
-ffunction-sections \
-fno-exceptions \
-fstack-usage \
-g3 \
-mthumb \
-std=gnu11
cpp_compiler_options += \
--specs=nano.specs \
-Os \
-fdata-sections \
-fno-exceptions \
-fno-rtti \
-g3 \
-MMD \
-MP \
-Wall \
-femit-class-debug-always \
-ffunction-sections \
-fno-use-cxa-atexit \
-fstack-usage \
-mthumb \
-std=gnu++14
linker_options += \
--specs=nosys.specs \
--specs=nano.specs \
-Os \
-Wl,--gc-sections -static \
-Wl,--print-memory-usage \
-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group \
-fno-exceptions \
-fno-rtti \
-g3 \
-mthumb
# Additional toolchain configuration for Cortex-M7 targets.
float_options := -mfpu=fpv5-d16 -mfloat-abi=hard
assembler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
c_compiler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
cpp_compiler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
linker_options += $(float_options) -mcpu=cortex-m7
c_compiler_options += -DSTM32H7S7xx -DUSE_HAL_DRIVER
cpp_compiler_options += -DSTM32H7S7xx -DUSE_HAL_DRIVER
# include everything + specific vendor folders
framework_includes := $(touchgfx_path)/framework/include
# this needs to change when assset include folder changes.
all_components := $(components) \
$(asset_fonts_output) \
$(asset_images_output) \
$(asset_texts_output) \
$(asset_videos_output)
include_paths := $(library_includes) \
$(foreach comp, $(all_components), $(comp)/include) \
$(foreach comp, $(touchgfx_generator_components), $(comp)/generated) \
$(framework_includes) \
$(cubemx_middlewares_path) \
$(touchgfx_middlewares_path) \
$(touchgfx_generator_components)
source_paths = $(foreach comp, $(all_components), $(comp)/src) \
$(touchgfx_generator_components)
# Finds files that matches the specified pattern. The directory list
# is searched recursively. It is safe to invoke this function with an
# empty list of directories.
#
# Param $(1): List of directories to search
# Param $(2): The file pattern to search for
define find
$(foreach dir,$(1),$(foreach d,$(wildcard $(dir)/*),\
$(call find,$(d),$(2))) $(wildcard $(dir)/$(strip $(2))))
endef
unexport find
fontconvert_ttf_lower_files := $(call find, $(asset_fonts_input), *.ttf)
fontconvert_ttf_upper_files := $(call find, $(asset_fonts_input), *.TTF)
fontconvert_otf_lower_files := $(call find, $(asset_fonts_input), *.otf)
fontconvert_otf_upper_files := $(call find, $(asset_fonts_input), *.OTF)
fontconvert_bdf_lower_files := $(call find, $(asset_fonts_input), *.bdf)
fontconvert_bdf_upper_files := $(call find, $(asset_fonts_input), *.BDF)
fontconvert_font_files := \
$(fontconvert_ttf_lower_files) \
$(fontconvert_ttf_upper_files) \
$(fontconvert_otf_lower_files) \
$(fontconvert_otf_upper_files) \
$(fontconvert_bdf_lower_files) \
$(fontconvert_bdf_upper_files)
source_files := $(call find, $(source_paths),*.cpp)
video_files := $(call find, $(assets_videos_input),*.avi)
# Drivers/STM32H7RSxx_HAL_Driver
board_c_files += \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_cortex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_crc.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_crc_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_dma.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_dma_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_dma2d.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_exti.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_flash.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_flash_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_gpio.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_gpu2d.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_i2c.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_i2c_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_icache.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_jpeg.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_ltdc.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_ltdc_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_pwr.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_pwr_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_rcc.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_rcc_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_smbus.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_smbus_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_tim.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_tim_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_xspi.c
board_c_files += \
Appli/Core/Src/main.c \
Appli/Core/Src/freertos.c \
Appli/Core/Src/stm32h7rsxx_it.c \
Appli/Core/Src/stm32h7rsxx_hal_msp.c \
Appli/Core/Src/stm32h7rsxx_hal_timebase_tim.c \
Appli/Core/Src/system_stm32h7rsxx.c \
Appli/Core/Src/audio_effects.c \
Appli/Core/Src/audio_analysis.c \
Appli/Core/Src/audio_looper.c \
Appli/Core/Src/fx_octaver.c \
Appli/Core/Src/fx_equalizer.c \
Appli/Core/Src/fx_overdrive.c \
Appli/Core/Src/fx_saturation.c \
Appli/Core/Src/fx_echo.c \
Appli/Core/Src/fx_reverb.c
# CMSIS-DSP (vendored from the STM32H7RS firmware package, source-only : no
# precompiled .a for this device). Only the RFFT float32 chain needed by
# audio_analysis.c is included, not the whole library. The MVE/Helium code
# paths in arm_cfft_f32.c/arm_cfft_init_f32.c are guarded behind
# ARM_MATH_MVEF, which is never defined here, so they compile out on this
# Cortex-M7 (no Helium) target.
board_c_files += \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_f32.c \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_init_f32.c \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_cfft_f32.c \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_cfft_init_f32.c \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix8_f32.c \
$(Drivers_path)/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal2.c \
$(Drivers_path)/CMSIS/DSP/Source/CommonTables/arm_common_tables.c \
$(Drivers_path)/CMSIS/DSP/Source/CommonTables/arm_const_structs.c
# Drivers
board_include_paths := \
$(Drivers_path)/CMSIS/Include \
$(Drivers_path)/CMSIS/Device/ST/STM32H7RSxx/Include \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Inc \
$(Drivers_path)/CMSIS/RTOS2/Include \
$(Drivers_path)/STM32H7RSxx_BSP/STM32H7S78-DK \
$(Drivers_path)/STM32H7RSxx_BSP/Components/wm8904 \
$(Drivers_path)/CMSIS/DSP/Include \
$(Drivers_path)/CMSIS/DSP/PrivateInclude \
Appli/Core/Inc \
$(gpu2d_path)/TouchGFXNema/include \
$(gpu2d_path)/NemaGFX/include
board_c_files += \
$(Drivers_path)/STM32H7RSxx_BSP/STM32H7S78-DK/stm32h7s78_discovery_audio.c \
$(Drivers_path)/STM32H7RSxx_BSP/STM32H7S78-DK/stm32h7s78_discovery_bus.c \
$(Drivers_path)/STM32H7RSxx_BSP/STM32H7S78-DK/stm32h7s78_discovery.c \
$(Drivers_path)/STM32H7RSxx_BSP/Components/wm8904/wm8904.c \
$(Drivers_path)/STM32H7RSxx_BSP/Components/wm8904/wm8904_reg.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_mdf.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_i2s.c
asm_source_files := \
gcc/startup_stm32h7s7l8hxh_appli.s
include_paths += platform/os $(board_include_paths) $(os_include_paths)
video_object_files := $(call find, $(asset_videos_output),*.o)
c_source_files := $(makefile_path_relative)/sysmem.c $(makefile_path_relative)/syscalls.c $(call find, $(source_paths),*.c) $(os_source_files) $(board_c_files)
source_files += $(board_cpp_files)
object_files := $(source_files) $(c_source_files)
# start converting paths
object_files := $(object_files:$(touchgfx_path)/%.cpp=$(object_output_path)/touchgfx/%.o)
object_files := $(object_files:%.cpp=$(object_output_path)/%.o)
object_files := $(object_files:$(touchgfx_middlewares_path)/%.c=$(object_output_path)/$(touchgfx_middlewares_path)/%.o)
object_files := $(object_files:$(cubemx_middlewares_path)/%.c=$(object_output_path)/$(cubemx_middlewares_path)/%.o)
object_files := $(object_files:$(Drivers_path)/%.c=$(object_output_path)/Drivers/%.o)
object_files := $(object_files:%.c=$(object_output_path)/%.o)
# remove templates files
object_files := $(filter-out %template.o,$(object_files))
dependency_files := $(object_files:%.o=%.d)
object_asm_files := $(asm_source_files:%.s=$(object_output_path)/%.o)
object_asm_files := $(patsubst $(object_output_path)/%,$(object_output_path)/%,$(object_asm_files))
textconvert_script_path := $(touchgfx_path)/framework/tools/textconvert
textconvert_executable := $(call find, $(textconvert_script_path), *.rb)
videoconvert_script_path := $(touchgfx_path)/framework/tools/videoconvert
text_database := $(asset_texts_input)/texts.xml
libraries := touchgfx-float-abi-hard
library_include_paths := $(touchgfx_path)/lib/core/$(platform)/gcc \
libraries += touchgfxnema-float-abi-hard \
nemagfx-float-abi-hard
library_include_paths += $(gpu2d_path)/TouchGFXNema/lib/cortex_m7/gcc \
$(gpu2d_path)/NemaGFX/lib/core/cortex_m7/gcc
.PHONY: _all_ _clean_ _assets_ _flash_ _intflash_ generate_assets build_executable
# Force linking each time
.PHONY: $(binary_output_path)/$(target_executable)
_all_: generate_assets
# if ExtFlashSection or FontFlashSection is detected inside the executable, enable external flash
flash_section_count := 0
elf_filename := "$(application_path)/$(binary_output_path)/$(target_executable)"
ifeq ($(shell test -e $(elf_filename) && echo -n has_elf_file),has_elf_file)
flash_section_count := $(shell readelf -S $(elf_filename) | grep FlashSection | wc -l)
endif
ifeq ($(shell test $(flash_section_count) -gt 0; echo $$?),0)
_flash_: _extflash_
else
_flash_: _intflash_
endif
include $(application_path)/gcc/include/flash_sections_int_ext.mk
generate_assets: _assets_
@$(MAKE) -f $(makefile_name) -r -s $(MFLAGS) build_executable
build_executable: $(binary_output_path)/$(target_executable)
$(binary_output_path)/$(target_executable): $(object_files) $(object_asm_files)
@echo Video Objects: $(video_object_files)
@echo Linking $(@)
@mkdir -p $(@D)
@mkdir -p $(object_output_path)
@$(file >$(build_root_path)/objects.tmp) $(foreach F,$(object_files) $(video_object_files),$(file >>$(build_root_path)/objects.tmp,$F))
@$(linker) \
$(linker_options) -T $(makefile_path_relative)/../Appli/stm32h7rsxx_RAMxspi1_ROMxspi2.ld -Wl,-Map=$(@D)/application.map $(linker_options_local) \
$(patsubst %,-L%,$(library_include_paths)) \
@$(build_root_path)/objects.tmp $(object_asm_files) -o $@ \
-Wl,--start-group $(patsubst %,-l%,$(libraries)) -Wl,--end-group
@rm -f $(build_root_path)/objects.tmp
@echo "Producing additional output formats..."
@echo " target.hex - Combined internal+external hex"
@$(objcopy) -O ihex $@ $(@D)/target.hex
@echo " intflash.elf - Internal flash, elf debug"
@$(objcopy) --remove-section=ExtFlashSection --remove-section=FontFlashSection --remove-section=TextFlashSection $@ $(@D)/intflash.elf 2>/dev/null
@echo " intflash.hex - Internal flash, hex"
@$(objcopy) -O ihex --remove-section=ExtFlashSection --remove-section=FontFlashSection --remove-section=TextFlashSection $@ $(@D)/intflash.hex
# re-enable if extflash binaries are required in your workflow
# @echo " extflash.bin - External flash, binary"
# @$(objcopy) -O binary --only-section=*FlashSection $@ $(@D)/extflash.bin
$(object_output_path)/touchgfx/%.o: $(touchgfx_path)/%.cpp Appli/TouchGFX/config/gcc/app.mk
@echo Compiling $<
@mkdir -p $(@D)
@$(cpp_compiler) \
-MMD -MP $(cpp_compiler_options) $(cpp_compiler_options_local) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.cpp Appli/TouchGFX/config/gcc/app.mk
@echo Compiling $<
@mkdir -p $(@D)
@$(cpp_compiler) \
-MMD -MP $(cpp_compiler_options) $(cpp_compiler_options_local) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/touchgfx/%.o: $(touchgfx_path)/%.c Appli/TouchGFX/config/gcc/app.mk
@echo Compiling $<
@mkdir -p $(@D)
@$(c_compiler) \
-MMD -MP $(c_compiler_options) $(c_compiler_options_local) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.c Appli/TouchGFX/config/gcc/app.mk
@echo Compiling $<
@mkdir -p $(@D)
@$(c_compiler) \
-MMD -MP $(c_compiler_options) $(c_compiler_options_local) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.s Appli/TouchGFX/config/gcc/app.mk
@echo Compiling ASM $<
@mkdir -p $(@D)
@$(assembler) \
$(assembler_options) \
$(patsubst %,-I %,$(os_include_paths)) \
-c $< -o $@
ifeq ($(MAKECMDGOALS),build_executable)
$(firstword $(dependency_files)): Appli/TouchGFX/config/gcc/app.mk
@rm -rf $(object_output_path)
-include $(dependency_files)
endif
_assets_: images texts Videos
.PHONY: images texts Videos
images:
@$(imageconvert_executable) -r $(asset_images_input) -w $(asset_images_output)
Videos:
@ruby $(videoconvert_script_path)/videoconvert.rb $(asset_videos_input) $(asset_videos_output)
texts:
@ruby $(textconvert_script_path)/main.rb $(text_database) $(fontconvert_executable) $(asset_fonts_output) $(asset_texts_output) $(asset_fonts_input) Appli/TouchGFX
_clean_:
@echo Cleaning
@rm -rf $(build_root_path)
# Do not remove gui_generated
@rm -rf $(asset_images_output)
@rm -rf $(asset_fonts_output)
@rm -rf $(asset_texts_output)
@rm -rf $(asset_videos_output)
# Create directory to avoid error if it does not exist
@mkdir -p $(asset_root_path)
# Remove assets folder if it is empty (i.e. no gui_generated folder)
@rmdir $(asset_root_path) 2>/dev/null || true
+295
View File
@@ -0,0 +1,295 @@
# Helper macros to convert spaces into question marks and back again
e :=
sp := $(e) $(e)
qs = $(subst ?,$(sp),$1)
sq = $(subst $(sp),?,$1)
# Get name of this Makefile (avoid getting word 0 and a starting space)
makefile_name := $(wordlist 1,1000,$(MAKEFILE_LIST))
# Get path of this Makefile
makefile_path := $(call qs,$(dir $(call sq,$(abspath $(call sq,$(makefile_name))))))
# Get path where the Application is
application_path := $(call qs,$(abspath $(call sq,$(makefile_path)..)))
# Change makefile_name to a relative path
makefile_name := $(subst $(call sq,$(application_path))/,,$(call sq,$(abspath $(call sq,$(makefile_name)))))
# Get relative path to makefile from application_path
makefile_path_relative := $(subst $(call sq,$(application_path))/,,$(call sq,$(abspath $(call sq,$(makefile_path)))))
# Get path to Drivers
Drivers_path := Drivers
# Get path to ExtMem_Manager
ExtMem_Manager_path := Middlewares/ST/STM32_ExtMem_Manager
# Get identification of this system
ifeq ($(OS),Windows_NT)
UNAME := MINGW32_NT-6.2
else
UNAME := $(shell uname -s)
endif
board_name := STM32H7S78-DK
platform := cortex_m7
.PHONY: all clean assets flash intflash
all: $(filter clean,$(MAKECMDGOALS))
all clean assets:
@cd "$(application_path)" && $(MAKE) -r -f $(makefile_name) -s $(MFLAGS) _$@_
flash intflash: all
@cd "$(application_path)" && $(MAKE) -r -f $(makefile_name) -s $(MFLAGS) _$@_
build_root_path := Boot/TouchGFX/build
object_output_path := $(build_root_path)/$(board_name)
binary_output_path := $(build_root_path)/bin
ifeq ($(UNAME), Linux)
else
stldr := MX66UW1G45G_STM32H7S78-DK.stldr
include $(application_path)/gcc/include/cube_programmer.mk
endif
target_executable := target.elf
target_hex := target.hex
assembler := arm-none-eabi-gcc
c_compiler := arm-none-eabi-gcc
cpp_compiler := arm-none-eabi-g++
linker := arm-none-eabi-g++
objcopy := arm-none-eabi-objcopy
archiver := arm-none-eabi-ar
strip := arm-none-eabi-strip
assembler_options += \
-MMD \
-MP \
-Wall \
-c \
-fno-exceptions \
-g \
-mthumb \
-x assembler-with-cpp
c_compiler_options += \
--specs=nano.specs \
-MMD \
-MP \
-Os \
-Wall \
-fdata-sections \
-fdata-sections \
-ffunction-sections \
-fno-exceptions \
-fstack-usage \
-g \
-mthumb \
-std=gnu11
cpp_compiler_options += \
--specs=nano.specs \
-MMD \
-MP \
-Os \
-fdata-sections \
-ffunction-sections \
-fno-exceptions \
-fno-rtti \
-g \
-mthumb \
-std=gnu++14
linker_options += \
--specs=nosys.specs \
-Os \
-Wl,--gc-sections -static \
-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group \
-fno-exceptions \
-fno-rtti \
-g \
-mthumb
# Additional toolchain configuration for Cortex-M4 targets.
float_options := -mfpu=fpv5-sp-d16 -mfloat-abi=hard
assembler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
c_compiler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
cpp_compiler_options += $(float_options) -mcpu=cortex-m7 -DCORE_CM7
linker_options += $(float_options) -mcpu=cortex-m7
c_compiler_options += -DST -DSTM32H7S7xx -DUSE_HAL_DRIVER -DUSE_STM32H7S78_DK -DUSE_PWR_LDO_SUPPLY__N -DUSE_FLOATING_POINT
cpp_compiler_options += -DST -DSTM32H7S7xx -DUSE_HAL_DRIVER -DUSE_STM32H7S78_DK -DUSE_PWR_LDO_SUPPLY__N -DUSE_FLOATING_POINT
# Drivers/STM32H7RSxx_HAL_Driver
source_files += \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_cortex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_dma.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_dma_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_exti.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_flash.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_flash_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_gpio.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_pwr.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_pwr_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_rcc.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_rcc_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_tim.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_tim_ex.c \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Src/stm32h7rsxx_hal_xspi.c
source_files += \
Boot/Core/Src/main.c \
Boot/Core/Src/stm32h7rsxx_it.c \
Boot/Core/Src/stm32h7rsxx_hal_msp.c \
Boot/Core/Src/system_stm32h7rsxx.c \
Boot/Core/Src/extmem_manager.c \
$(ExtMem_Manager_path)/stm32_extmem.c \
$(ExtMem_Manager_path)/boot/stm32_boot_xip.c \
$(ExtMem_Manager_path)/nor_sfdp/stm32_sfdp_data.c \
$(ExtMem_Manager_path)/nor_sfdp/stm32_sfdp_driver.c \
$(ExtMem_Manager_path)/psram/stm32_psram_driver.c \
$(ExtMem_Manager_path)/sal/stm32_sal_sd.c \
$(ExtMem_Manager_path)/sal/stm32_sal_xspi.c \
$(ExtMem_Manager_path)/sdcard/stm32_sdcard_driver.c \
$(ExtMem_Manager_path)/user/stm32_user_driver.c
# Drivers
board_include_paths := \
$(Drivers_path)/CMSIS/Include \
$(Drivers_path)/CMSIS/Device/ST/STM32H7RSxx/Include \
$(Drivers_path)/STM32H7RSxx_HAL_Driver/Inc \
$(Drivers_path)/CMSIS/RTOS2/Include \
Boot/Core/Inc \
$(ExtMem_Manager_path) \
$(ExtMem_Manager_path)/boot \
$(ExtMem_Manager_path)/nor_sfdp \
$(ExtMem_Manager_path)/psram \
$(ExtMem_Manager_path)/sal \
$(ExtMem_Manager_path)/sdcard \
$(ExtMem_Manager_path)/user
asm_source_files := \
gcc/startup_stm32h7s7l8hxh_boot.s
include_paths += platform/os $(board_include_paths) $(os_include_paths)
c_source_files := $(makefile_path_relative)/sysmem.c $(makefile_path_relative)/syscalls.c $(call find, $(source_paths),*.c) $(os_source_files) $(board_c_files)
source_files += $(board_cpp_files)
object_files := $(source_files) $(c_source_files)
# start converting paths
object_files := $(object_files:%.cpp=$(object_output_path)/%.o)
object_files := $(object_files:%.c=$(object_output_path)/%.o)
object_files := $(object_files:$(Drivers_path)/%.c=$(object_output_path)/Drivers/%.o)
# remove templates files
# object_files := $(filter-out %template.o,$(object_files))
dependency_files := $(object_files:%.o=%.d)
object_asm_files := $(asm_source_files:%.s=$(object_output_path)/%.o)
object_asm_files := $(patsubst $(object_output_path)/%,$(object_output_path)/%,$(object_asm_files))
.PHONY: _all_ _clean_ _assets_ _flash_ _intflash_ generate_assets build_executable
# Force linking each time
.PHONY: $(binary_output_path)/$(target_executable)
_all_: generate_assets
# if ExtFlashSection or FontFlashSection is detected inside the executable, enable external flash
flash_section_count := 0
elf_filename := "$(application_path)/$(binary_output_path)/$(target_executable)"
ifeq ($(shell test -e $(elf_filename) && echo -n has_elf_file),has_elf_file)
flash_section_count := $(shell readelf -S $(elf_filename) | grep FlashSection | wc -l)
endif
ifeq ($(shell test $(flash_section_count) -gt 0; echo $$?),0)
_flash_: _extflash_
else
_flash_: _intflash_
endif
include $(application_path)/gcc/include/flash_sections_int_ext.mk
generate_assets: _assets_
@$(MAKE) -f $(makefile_name) -r -s $(MFLAGS) build_executable
build_executable: $(binary_output_path)/$(target_executable)
$(binary_output_path)/$(target_executable): $(object_files) $(object_asm_files)
@echo Linking $(@)
@mkdir -p $(@D)
@mkdir -p $(object_output_path)
@$(file >$(build_root_path)/objects.tmp) $(foreach F,$(object_files),$(file >>$(build_root_path)/objects.tmp,$F))
@$(linker) \
$(linker_options) -T $(makefile_path_relative)/../Boot/stm32h7s7xx_flash.ld -Wl,-Map=$(@D)/application.map \
$(patsubst %,-L%,$(library_include_paths)) \
@$(build_root_path)/objects.tmp $(object_asm_files) -o $@ \
-Wl,--start-group -Wl,--end-group
@rm -f $(build_root_path)/objects.tmp
@echo "Producing additional output formats..."
@echo " target.hex - Combined internal+external hex"
@$(objcopy) -O ihex $@ $(@D)/target.hex
@echo " intflash.elf - Internal flash, elf debug"
@$(objcopy) $@ $(@D)/intflash.elf 2>/dev/null
@echo " intflash.hex - Internal flash, hex"
@$(objcopy) -O ihex $@ $(@D)/intflash.hex
# Re-enable the lines below if your workflow requires extflash.bin files
# @echo " extflash.bin - External flash, binary"
# @$(objcopy) -O binary $@ $(@D)/extflash.bin
$(object_output_path)/touchgfx/%.o: $(touchgfx_path)/%.cpp
@echo Compiling $<
@mkdir -p $(@D)
@$(cpp_compiler) \
-MMD -MP $(cpp_compiler_options) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.cpp
@echo Compiling $<
@mkdir -p $(@D)
@$(cpp_compiler) \
-MMD -MP $(cpp_compiler_options) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/touchgfx/%.o: $(touchgfx_path)/%.c
@echo Compiling $<
@mkdir -p $(@D)
@$(c_compiler) \
-MMD -MP $(c_compiler_options) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.c
@echo Compiling $<
@mkdir -p $(@D)
@$(c_compiler) \
-MMD -MP $(c_compiler_options) $(user_cflags) \
$(patsubst %,-I%,$(include_paths)) \
-c $< -o $@
$(object_output_path)/%.o: %.s
@echo Compiling ASM $<
@mkdir -p $(@D)
@$(assembler) \
$(assembler_options) \
$(patsubst %,-I %,$(os_include_paths)) \
-c $< -o $@
ifeq ($(MAKECMDGOALS),build_executable)
$(firstword $(dependency_files)):
@rm -rf $(object_output_path)
-include $(dependency_files)
endif
_clean_:
@echo Cleaning: $(board_name)
@rm -rf $(build_root_path)
+1
View File
@@ -0,0 +1 @@
find: /c/ST/STM32CubeCLT/STM32CubeCLT//STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI.exe: No such file or directory
+780
View File
@@ -0,0 +1,780 @@
/**
******************************************************************************
* @file startup_stm32h7s7xx.s
* @author MCD Application Team
* @brief STM32H7S7xx Devices vector table for GCC toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR address
* - Branches to main in the C library (which eventually
* calls main()).
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
.syntax unified
.cpu cortex-m7
.fpu softvfp
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
ldr r0, =_estack
mov sp, r0 /* set stack pointer */
/* Call the clock system initialization function.*/
bl SystemInit
/* Copy the data segment initializers from flash to SRAM */
ldr r0, =_sdata
ldr r1, =_edata
ldr r2, =_sidata
movs r3, #0
b LoopCopyDataInit
CopyDataInit:
ldr r4, [r2, r3]
str r4, [r0, r3]
adds r3, r3, #4
LoopCopyDataInit:
adds r4, r0, r3
cmp r4, r1
bcc CopyDataInit
/* Zero fill the bss segment. */
ldr r2, =_sbss
ldr r4, =_ebss
movs r3, #0
b LoopFillZerobss
FillZerobss:
str r3, [r2]
adds r2, r2, #4
LoopFillZerobss:
cmp r2, r4
bcc FillZerobss
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
LoopForever:
b LoopForever
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval : None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The STM32H7S7xx vector table. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
/* External Interrupts */
.word PVD_PVM_IRQHandler /* PVD/PVM through EXTI Line detection */
.word 0 /* Reserved */
.word DTS_IRQHandler /* Digital Temperature Sensor */
.word IWDG_IRQHandler /* Internal Watchdog */
.word WWDG_IRQHandler /* Window Watchdog */
.word RCC_IRQHandler /* RCC global interrupts through EXTI Line detection */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word FLASH_IRQHandler /* FLASH interrupts */
.word RAMECC_IRQHandler /* RAMECC interrupts */
.word FPU_IRQHandler /* FPU */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word TAMP_IRQHandler /* Tamper and TimeStamp interrupts */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word EXTI0_IRQHandler /* EXTI Line0 */
.word EXTI1_IRQHandler /* EXTI Line1 */
.word EXTI2_IRQHandler /* EXTI Line2 */
.word EXTI3_IRQHandler /* EXTI Line3 */
.word EXTI4_IRQHandler /* EXTI Line4 */
.word EXTI5_IRQHandler /* EXTI Line5 */
.word EXTI6_IRQHandler /* EXTI Line6 */
.word EXTI7_IRQHandler /* EXTI Line7 */
.word EXTI8_IRQHandler /* EXTI Line8 */
.word EXTI9_IRQHandler /* EXTI Line9 */
.word EXTI10_IRQHandler /* EXTI Line10 */
.word EXTI11_IRQHandler /* EXTI Line11 */
.word EXTI12_IRQHandler /* EXTI Line12 */
.word EXTI13_IRQHandler /* EXTI Line13 */
.word EXTI14_IRQHandler /* EXTI Line14 */
.word EXTI15_IRQHandler /* EXTI Line15 */
.word RTC_IRQHandler /* RTC wakeup and alarm interrupts */
.word SAES_IRQHandler /* SAES */
.word CRYP_IRQHandler /* CRYP */
.word PKA_IRQHandler /* PKA */
.word HASH_IRQHandler /* HASH */
.word RNG_IRQHandler /* RNG */
.word ADC1_2_IRQHandler /* ADC1 & ADC2 */
.word GPDMA1_Channel0_IRQHandler /* GPDMA1 Channel 0 */
.word GPDMA1_Channel1_IRQHandler /* GPDMA1 Channel 1 */
.word GPDMA1_Channel2_IRQHandler /* GPDMA1 Channel 2 */
.word GPDMA1_Channel3_IRQHandler /* GPDMA1 Channel 3 */
.word GPDMA1_Channel4_IRQHandler /* GPDMA1 Channel 4 */
.word GPDMA1_Channel5_IRQHandler /* GPDMA1 Channel 5 */
.word GPDMA1_Channel6_IRQHandler /* GPDMA1 Channel 6 */
.word GPDMA1_Channel7_IRQHandler /* GPDMA1 Channel 7 */
.word TIM1_BRK_IRQHandler /* TIM1 Break */
.word TIM1_UP_IRQHandler /* TIM1 Update */
.word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation */
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
.word TIM2_IRQHandler /* TIM2 */
.word TIM3_IRQHandler /* TIM3 */
.word TIM4_IRQHandler /* TIM4 */
.word TIM5_IRQHandler /* TIM5 */
.word TIM6_IRQHandler /* TIM6 */
.word TIM7_IRQHandler /* TIM7 */
.word TIM9_IRQHandler /* TIM9 */
.word SPI1_IRQHandler /* SPI1 */
.word SPI2_IRQHandler /* SPI2 */
.word SPI3_IRQHandler /* SPI3 */
.word SPI4_IRQHandler /* SPI4 */
.word SPI5_IRQHandler /* SPI5 */
.word SPI6_IRQHandler /* SPI6 */
.word HPDMA1_Channel0_IRQHandler /* HPDMA1 Channel 0 */
.word HPDMA1_Channel1_IRQHandler /* HPDMA1 Channel 1 */
.word HPDMA1_Channel2_IRQHandler /* HPDMA1 Channel 2 */
.word HPDMA1_Channel3_IRQHandler /* HPDMA1 Channel 3 */
.word HPDMA1_Channel4_IRQHandler /* HPDMA1 Channel 4 */
.word HPDMA1_Channel5_IRQHandler /* HPDMA1 Channel 5 */
.word HPDMA1_Channel6_IRQHandler /* HPDMA1 Channel 6 */
.word HPDMA1_Channel7_IRQHandler /* HPDMA1 Channel 7 */
.word SAI1_A_IRQHandler /* Serial Audio Interface 1 block A */
.word SAI1_B_IRQHandler /* Serial Audio Interface 1 block B */
.word SAI2_A_IRQHandler /* Serial Audio Interface 2 block A */
.word SAI2_B_IRQHandler /* Serial Audio Interface 2 block B */
.word I2C1_EV_IRQHandler /* I2C1 Event */
.word I2C1_ER_IRQHandler /* I2C1 Error */
.word I2C2_EV_IRQHandler /* I2C2 Event */
.word I2C2_ER_IRQHandler /* I2C2 Error */
.word I2C3_EV_IRQHandler /* I2C3 Event */
.word I2C3_ER_IRQHandler /* I2C3 Error */
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word USART3_IRQHandler /* USART3 */
.word UART4_IRQHandler /* UART4 */
.word UART5_IRQHandler /* UART5 */
.word UART7_IRQHandler /* UART7 */
.word UART8_IRQHandler /* UART8 */
.word I3C1_EV_IRQHandler /* I3C1 Event */
.word I3C1_ER_IRQHandler /* I3C1 Error */
.word OTG_HS_IRQHandler /* USB OTG HS */
.word ETH_IRQHandler /* Ethernet */
.word CORDIC_IRQHandler /* CORDIC */
.word GFXTIM_IRQHandler /* GFXTIM */
.word DCMIPP_IRQHandler /* DCMIPP */
.word LTDC_IRQHandler /* LTDC */
.word LTDC_ER_IRQHandler /* LTDC error */
.word DMA2D_IRQHandler /* DMA2D */
.word JPEG_IRQHandler /* JPEG */
.word GFXMMU_IRQHandler /* GFXMMU */
.word I3C1_WKUP_IRQHandler /* I3C1 wakeup */
.word MCE1_IRQHandler /* MCE1 */
.word MCE2_IRQHandler /* MCE2 */
.word MCE3_IRQHandler /* MCE3 */
.word XSPI1_IRQHandler /* XSPI1 */
.word XSPI2_IRQHandler /* XSPI2 */
.word FMC_IRQHandler /* FMC */
.word SDMMC1_IRQHandler /* SDMMC1 */
.word SDMMC2_IRQHandler /* SDMMC2 */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word OTG_FS_IRQHandler /* USB OTG FS */
.word TIM12_IRQHandler /* TIM12 */
.word TIM13_IRQHandler /* TIM13 */
.word TIM14_IRQHandler /* TIM14 */
.word TIM15_IRQHandler /* TIM15 */
.word TIM16_IRQHandler /* TIM16 */
.word TIM17_IRQHandler /* TIM17 */
.word LPTIM1_IRQHandler /* LP TIM1 */
.word LPTIM2_IRQHandler /* LP TIM2 */
.word LPTIM3_IRQHandler /* LP TIM3 */
.word LPTIM4_IRQHandler /* LP TIM4 */
.word LPTIM5_IRQHandler /* LP TIM5 */
.word SPDIF_RX_IRQHandler /* SPDIF_RX */
.word MDIOS_IRQHandler /* MDIOS */
.word ADF1_FLT0_IRQHandler /* ADF1 Filter 0 */
.word CRS_IRQHandler /* CRS */
.word UCPD1_IRQHandler /* UCPD1 */
.word CEC_IRQHandler /* HDMI_CEC */
.word PSSI_IRQHandler /* PSSI */
.word LPUART1_IRQHandler /* LP UART1 */
.word WAKEUP_PIN_IRQHandler /* Wake-up pins interrupt */
.word GPDMA1_Channel8_IRQHandler /* GPDMA1 Channel 8 */
.word GPDMA1_Channel9_IRQHandler /* GPDMA1 Channel 9 */
.word GPDMA1_Channel10_IRQHandler /* GPDMA1 Channel 10 */
.word GPDMA1_Channel11_IRQHandler /* GPDMA1 Channel 11 */
.word GPDMA1_Channel12_IRQHandler /* GPDMA1 Channel 12 */
.word GPDMA1_Channel13_IRQHandler /* GPDMA1 Channel 13 */
.word GPDMA1_Channel14_IRQHandler /* GPDMA1 Channel 14 */
.word GPDMA1_Channel15_IRQHandler /* GPDMA1 Channel 15 */
.word HPDMA1_Channel8_IRQHandler /* HPDMA1 Channel 8 */
.word HPDMA1_Channel9_IRQHandler /* HPDMA1 Channel 9 */
.word HPDMA1_Channel10_IRQHandler /* HPDMA1 Channel 10 */
.word HPDMA1_Channel11_IRQHandler /* HPDMA1 Channel 11 */
.word HPDMA1_Channel12_IRQHandler /* HPDMA1 Channel 12 */
.word HPDMA1_Channel13_IRQHandler /* HPDMA1 Channel 13 */
.word HPDMA1_Channel14_IRQHandler /* HPDMA1 Channel 14 */
.word HPDMA1_Channel15_IRQHandler /* HPDMA1 Channel 15 */
.word GPU2D_IRQHandler /* GPU2D */
.word GPU2D_ER_IRQHandler /* GPU2D error */
.word ICACHE_IRQHandler /* ICACHE */
.word FDCAN1_IT0_IRQHandler /* FDCAN1 Interrupt 0 */
.word FDCAN1_IT1_IRQHandler /* FDCAN1 Interrupt 1 */
.word FDCAN2_IT0_IRQHandler /* FDCAN2 Interrupt 0 */
.word FDCAN2_IT1_IRQHandler /* FDCAN2 Interrupt 1 */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak PVD_PVM_IRQHandler
.thumb_set PVD_PVM_IRQHandler,Default_Handler
.weak DTS_IRQHandler
.thumb_set DTS_IRQHandler,Default_Handler
.weak IWDG_IRQHandler
.thumb_set IWDG_IRQHandler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RAMECC_IRQHandler
.thumb_set RAMECC_IRQHandler,Default_Handler
.weak FPU_IRQHandler
.thumb_set FPU_IRQHandler,Default_Handler
.weak TAMP_IRQHandler
.thumb_set TAMP_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak EXTI5_IRQHandler
.thumb_set EXTI5_IRQHandler,Default_Handler
.weak EXTI6_IRQHandler
.thumb_set EXTI6_IRQHandler,Default_Handler
.weak EXTI7_IRQHandler
.thumb_set EXTI7_IRQHandler,Default_Handler
.weak EXTI8_IRQHandler
.thumb_set EXTI8_IRQHandler,Default_Handler
.weak EXTI9_IRQHandler
.thumb_set EXTI9_IRQHandler,Default_Handler
.weak EXTI10_IRQHandler
.thumb_set EXTI10_IRQHandler,Default_Handler
.weak EXTI11_IRQHandler
.thumb_set EXTI11_IRQHandler,Default_Handler
.weak EXTI12_IRQHandler
.thumb_set EXTI12_IRQHandler,Default_Handler
.weak EXTI13_IRQHandler
.thumb_set EXTI13_IRQHandler,Default_Handler
.weak EXTI14_IRQHandler
.thumb_set EXTI14_IRQHandler,Default_Handler
.weak EXTI15_IRQHandler
.thumb_set EXTI15_IRQHandler,Default_Handler
.weak RTC_IRQHandler
.thumb_set RTC_IRQHandler,Default_Handler
.weak SAES_IRQHandler
.thumb_set SAES_IRQHandler,Default_Handler
.weak CRYP_IRQHandler
.thumb_set CRYP_IRQHandler,Default_Handler
.weak PKA_IRQHandler
.thumb_set PKA_IRQHandler,Default_Handler
.weak HASH_IRQHandler
.thumb_set HASH_IRQHandler,Default_Handler
.weak RNG_IRQHandler
.thumb_set RNG_IRQHandler,Default_Handler
.weak ADC1_2_IRQHandler
.thumb_set ADC1_2_IRQHandler,Default_Handler
.weak GPDMA1_Channel0_IRQHandler
.thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler
.weak GPDMA1_Channel1_IRQHandler
.thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler
.weak GPDMA1_Channel2_IRQHandler
.thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler
.weak GPDMA1_Channel3_IRQHandler
.thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler
.weak GPDMA1_Channel4_IRQHandler
.thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler
.weak GPDMA1_Channel5_IRQHandler
.thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler
.weak GPDMA1_Channel6_IRQHandler
.thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler
.weak GPDMA1_Channel7_IRQHandler
.thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler
.weak TIM1_BRK_IRQHandler
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
.weak TIM1_UP_IRQHandler
.thumb_set TIM1_UP_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_IRQHandler
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak TIM5_IRQHandler
.thumb_set TIM5_IRQHandler,Default_Handler
.weak TIM6_IRQHandler
.thumb_set TIM6_IRQHandler,Default_Handler
.weak TIM7_IRQHandler
.thumb_set TIM7_IRQHandler,Default_Handler
.weak TIM9_IRQHandler
.thumb_set TIM9_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak SPI3_IRQHandler
.thumb_set SPI3_IRQHandler,Default_Handler
.weak SPI4_IRQHandler
.thumb_set SPI4_IRQHandler,Default_Handler
.weak SPI5_IRQHandler
.thumb_set SPI5_IRQHandler,Default_Handler
.weak SPI6_IRQHandler
.thumb_set SPI6_IRQHandler,Default_Handler
.weak HPDMA1_Channel0_IRQHandler
.thumb_set HPDMA1_Channel0_IRQHandler,Default_Handler
.weak HPDMA1_Channel1_IRQHandler
.thumb_set HPDMA1_Channel1_IRQHandler,Default_Handler
.weak HPDMA1_Channel2_IRQHandler
.thumb_set HPDMA1_Channel2_IRQHandler,Default_Handler
.weak HPDMA1_Channel3_IRQHandler
.thumb_set HPDMA1_Channel3_IRQHandler,Default_Handler
.weak HPDMA1_Channel4_IRQHandler
.thumb_set HPDMA1_Channel4_IRQHandler,Default_Handler
.weak HPDMA1_Channel5_IRQHandler
.thumb_set HPDMA1_Channel5_IRQHandler,Default_Handler
.weak HPDMA1_Channel6_IRQHandler
.thumb_set HPDMA1_Channel6_IRQHandler,Default_Handler
.weak HPDMA1_Channel7_IRQHandler
.thumb_set HPDMA1_Channel7_IRQHandler,Default_Handler
.weak SAI1_A_IRQHandler
.thumb_set SAI1_A_IRQHandler,Default_Handler
.weak SAI1_B_IRQHandler
.thumb_set SAI1_B_IRQHandler,Default_Handler
.weak SAI2_A_IRQHandler
.thumb_set SAI2_A_IRQHandler,Default_Handler
.weak SAI2_B_IRQHandler
.thumb_set SAI2_B_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak I2C3_EV_IRQHandler
.thumb_set I2C3_EV_IRQHandler,Default_Handler
.weak I2C3_ER_IRQHandler
.thumb_set I2C3_ER_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak UART4_IRQHandler
.thumb_set UART4_IRQHandler,Default_Handler
.weak UART5_IRQHandler
.thumb_set UART5_IRQHandler,Default_Handler
.weak UART7_IRQHandler
.thumb_set UART7_IRQHandler,Default_Handler
.weak UART8_IRQHandler
.thumb_set UART8_IRQHandler,Default_Handler
.weak I3C1_EV_IRQHandler
.thumb_set I3C1_EV_IRQHandler,Default_Handler
.weak I3C1_ER_IRQHandler
.thumb_set I3C1_ER_IRQHandler,Default_Handler
.weak OTG_HS_IRQHandler
.thumb_set OTG_HS_IRQHandler,Default_Handler
.weak ETH_IRQHandler
.thumb_set ETH_IRQHandler,Default_Handler
.weak CORDIC_IRQHandler
.thumb_set CORDIC_IRQHandler,Default_Handler
.weak GFXTIM_IRQHandler
.thumb_set GFXTIM_IRQHandler,Default_Handler
.weak DCMIPP_IRQHandler
.thumb_set DCMIPP_IRQHandler,Default_Handler
.weak LTDC_IRQHandler
.thumb_set LTDC_IRQHandler,Default_Handler
.weak LTDC_ER_IRQHandler
.thumb_set LTDC_ER_IRQHandler,Default_Handler
.weak DMA2D_IRQHandler
.thumb_set DMA2D_IRQHandler,Default_Handler
.weak JPEG_IRQHandler
.thumb_set JPEG_IRQHandler,Default_Handler
.weak GFXMMU_IRQHandler
.thumb_set GFXMMU_IRQHandler,Default_Handler
.weak I3C1_WKUP_IRQHandler
.thumb_set I3C1_WKUP_IRQHandler,Default_Handler
.weak MCE1_IRQHandler
.thumb_set MCE1_IRQHandler,Default_Handler
.weak MCE2_IRQHandler
.thumb_set MCE2_IRQHandler,Default_Handler
.weak MCE3_IRQHandler
.thumb_set MCE3_IRQHandler,Default_Handler
.weak XSPI1_IRQHandler
.thumb_set XSPI1_IRQHandler,Default_Handler
.weak XSPI2_IRQHandler
.thumb_set XSPI2_IRQHandler,Default_Handler
.weak FMC_IRQHandler
.thumb_set FMC_IRQHandler,Default_Handler
.weak SDMMC1_IRQHandler
.thumb_set SDMMC1_IRQHandler,Default_Handler
.weak SDMMC2_IRQHandler
.thumb_set SDMMC2_IRQHandler,Default_Handler
.weak OTG_FS_IRQHandler
.thumb_set OTG_FS_IRQHandler,Default_Handler
.weak TIM12_IRQHandler
.thumb_set TIM12_IRQHandler,Default_Handler
.weak TIM13_IRQHandler
.thumb_set TIM13_IRQHandler,Default_Handler
.weak TIM14_IRQHandler
.thumb_set TIM14_IRQHandler,Default_Handler
.weak TIM15_IRQHandler
.thumb_set TIM15_IRQHandler,Default_Handler
.weak TIM16_IRQHandler
.thumb_set TIM16_IRQHandler,Default_Handler
.weak TIM17_IRQHandler
.thumb_set TIM17_IRQHandler,Default_Handler
.weak LPTIM1_IRQHandler
.thumb_set LPTIM1_IRQHandler,Default_Handler
.weak LPTIM2_IRQHandler
.thumb_set LPTIM2_IRQHandler,Default_Handler
.weak LPTIM3_IRQHandler
.thumb_set LPTIM3_IRQHandler,Default_Handler
.weak LPTIM4_IRQHandler
.thumb_set LPTIM4_IRQHandler,Default_Handler
.weak LPTIM5_IRQHandler
.thumb_set LPTIM5_IRQHandler,Default_Handler
.weak SPDIF_RX_IRQHandler
.thumb_set SPDIF_RX_IRQHandler,Default_Handler
.weak MDIOS_IRQHandler
.thumb_set MDIOS_IRQHandler,Default_Handler
.weak ADF1_FLT0_IRQHandler
.thumb_set ADF1_FLT0_IRQHandler,Default_Handler
.weak CRS_IRQHandler
.thumb_set CRS_IRQHandler,Default_Handler
.weak UCPD1_IRQHandler
.thumb_set UCPD1_IRQHandler,Default_Handler
.weak CEC_IRQHandler
.thumb_set CEC_IRQHandler,Default_Handler
.weak PSSI_IRQHandler
.thumb_set PSSI_IRQHandler,Default_Handler
.weak LPUART1_IRQHandler
.thumb_set LPUART1_IRQHandler,Default_Handler
.weak WAKEUP_PIN_IRQHandler
.thumb_set WAKEUP_PIN_IRQHandler,Default_Handler
.weak GPDMA1_Channel8_IRQHandler
.thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler
.weak GPDMA1_Channel9_IRQHandler
.thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler
.weak GPDMA1_Channel10_IRQHandler
.thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler
.weak GPDMA1_Channel11_IRQHandler
.thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler
.weak GPDMA1_Channel12_IRQHandler
.thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler
.weak GPDMA1_Channel13_IRQHandler
.thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler
.weak GPDMA1_Channel14_IRQHandler
.thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler
.weak GPDMA1_Channel15_IRQHandler
.thumb_set GPDMA1_Channel15_IRQHandler,Default_Handler
.weak HPDMA1_Channel8_IRQHandler
.thumb_set HPDMA1_Channel8_IRQHandler,Default_Handler
.weak HPDMA1_Channel9_IRQHandler
.thumb_set HPDMA1_Channel9_IRQHandler,Default_Handler
.weak HPDMA1_Channel10_IRQHandler
.thumb_set HPDMA1_Channel10_IRQHandler,Default_Handler
.weak HPDMA1_Channel11_IRQHandler
.thumb_set HPDMA1_Channel11_IRQHandler,Default_Handler
.weak HPDMA1_Channel12_IRQHandler
.thumb_set HPDMA1_Channel12_IRQHandler,Default_Handler
.weak HPDMA1_Channel13_IRQHandler
.thumb_set HPDMA1_Channel13_IRQHandler,Default_Handler
.weak HPDMA1_Channel14_IRQHandler
.thumb_set HPDMA1_Channel14_IRQHandler,Default_Handler
.weak HPDMA1_Channel15_IRQHandler
.thumb_set HPDMA1_Channel15_IRQHandler,Default_Handler
.weak GPU2D_IRQHandler
.thumb_set GPU2D_IRQHandler,Default_Handler
.weak GPU2D_ER_IRQHandler
.thumb_set GPU2D_ER_IRQHandler,Default_Handler
.weak ICACHE_IRQHandler
.thumb_set ICACHE_IRQHandler,Default_Handler
.weak FDCAN1_IT0_IRQHandler
.thumb_set FDCAN1_IT0_IRQHandler,Default_Handler
.weak FDCAN1_IT1_IRQHandler
.thumb_set FDCAN1_IT1_IRQHandler,Default_Handler
.weak FDCAN2_IT0_IRQHandler
.thumb_set FDCAN2_IT0_IRQHandler,Default_Handler
.weak FDCAN2_IT1_IRQHandler
.thumb_set FDCAN2_IT1_IRQHandler,Default_Handler
.weak SystemInit
+780
View File
@@ -0,0 +1,780 @@
/**
******************************************************************************
* @file startup_stm32h7s7xx.s
* @author MCD Application Team
* @brief STM32H7S7xx Devices vector table for GCC toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR address
* - Branches to main in the C library (which eventually
* calls main()).
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
.syntax unified
.cpu cortex-m7
.fpu softvfp
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
ldr r0, =_estack
mov sp, r0 /* set stack pointer */
/* Call the clock system initialization function.*/
bl SystemInit
/* Copy the data segment initializers from flash to SRAM */
ldr r0, =_sdata
ldr r1, =_edata
ldr r2, =_sidata
movs r3, #0
b LoopCopyDataInit
CopyDataInit:
ldr r4, [r2, r3]
str r4, [r0, r3]
adds r3, r3, #4
LoopCopyDataInit:
adds r4, r0, r3
cmp r4, r1
bcc CopyDataInit
/* Zero fill the bss segment. */
ldr r2, =_sbss
ldr r4, =_ebss
movs r3, #0
b LoopFillZerobss
FillZerobss:
str r3, [r2]
adds r2, r2, #4
LoopFillZerobss:
cmp r2, r4
bcc FillZerobss
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
LoopForever:
b LoopForever
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval : None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The STM32H7S7xx vector table. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
/* External Interrupts */
.word PVD_PVM_IRQHandler /* PVD/PVM through EXTI Line detection */
.word 0 /* Reserved */
.word DTS_IRQHandler /* Digital Temperature Sensor */
.word IWDG_IRQHandler /* Internal Watchdog */
.word WWDG_IRQHandler /* Window Watchdog */
.word RCC_IRQHandler /* RCC global interrupts through EXTI Line detection */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word FLASH_IRQHandler /* FLASH interrupts */
.word RAMECC_IRQHandler /* RAMECC interrupts */
.word FPU_IRQHandler /* FPU */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word TAMP_IRQHandler /* Tamper and TimeStamp interrupts */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word EXTI0_IRQHandler /* EXTI Line0 */
.word EXTI1_IRQHandler /* EXTI Line1 */
.word EXTI2_IRQHandler /* EXTI Line2 */
.word EXTI3_IRQHandler /* EXTI Line3 */
.word EXTI4_IRQHandler /* EXTI Line4 */
.word EXTI5_IRQHandler /* EXTI Line5 */
.word EXTI6_IRQHandler /* EXTI Line6 */
.word EXTI7_IRQHandler /* EXTI Line7 */
.word EXTI8_IRQHandler /* EXTI Line8 */
.word EXTI9_IRQHandler /* EXTI Line9 */
.word EXTI10_IRQHandler /* EXTI Line10 */
.word EXTI11_IRQHandler /* EXTI Line11 */
.word EXTI12_IRQHandler /* EXTI Line12 */
.word EXTI13_IRQHandler /* EXTI Line13 */
.word EXTI14_IRQHandler /* EXTI Line14 */
.word EXTI15_IRQHandler /* EXTI Line15 */
.word RTC_IRQHandler /* RTC wakeup and alarm interrupts */
.word SAES_IRQHandler /* SAES */
.word CRYP_IRQHandler /* CRYP */
.word PKA_IRQHandler /* PKA */
.word HASH_IRQHandler /* HASH */
.word RNG_IRQHandler /* RNG */
.word ADC1_2_IRQHandler /* ADC1 & ADC2 */
.word GPDMA1_Channel0_IRQHandler /* GPDMA1 Channel 0 */
.word GPDMA1_Channel1_IRQHandler /* GPDMA1 Channel 1 */
.word GPDMA1_Channel2_IRQHandler /* GPDMA1 Channel 2 */
.word GPDMA1_Channel3_IRQHandler /* GPDMA1 Channel 3 */
.word GPDMA1_Channel4_IRQHandler /* GPDMA1 Channel 4 */
.word GPDMA1_Channel5_IRQHandler /* GPDMA1 Channel 5 */
.word GPDMA1_Channel6_IRQHandler /* GPDMA1 Channel 6 */
.word GPDMA1_Channel7_IRQHandler /* GPDMA1 Channel 7 */
.word TIM1_BRK_IRQHandler /* TIM1 Break */
.word TIM1_UP_IRQHandler /* TIM1 Update */
.word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation */
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
.word TIM2_IRQHandler /* TIM2 */
.word TIM3_IRQHandler /* TIM3 */
.word TIM4_IRQHandler /* TIM4 */
.word TIM5_IRQHandler /* TIM5 */
.word TIM6_IRQHandler /* TIM6 */
.word TIM7_IRQHandler /* TIM7 */
.word TIM9_IRQHandler /* TIM9 */
.word SPI1_IRQHandler /* SPI1 */
.word SPI2_IRQHandler /* SPI2 */
.word SPI3_IRQHandler /* SPI3 */
.word SPI4_IRQHandler /* SPI4 */
.word SPI5_IRQHandler /* SPI5 */
.word SPI6_IRQHandler /* SPI6 */
.word HPDMA1_Channel0_IRQHandler /* HPDMA1 Channel 0 */
.word HPDMA1_Channel1_IRQHandler /* HPDMA1 Channel 1 */
.word HPDMA1_Channel2_IRQHandler /* HPDMA1 Channel 2 */
.word HPDMA1_Channel3_IRQHandler /* HPDMA1 Channel 3 */
.word HPDMA1_Channel4_IRQHandler /* HPDMA1 Channel 4 */
.word HPDMA1_Channel5_IRQHandler /* HPDMA1 Channel 5 */
.word HPDMA1_Channel6_IRQHandler /* HPDMA1 Channel 6 */
.word HPDMA1_Channel7_IRQHandler /* HPDMA1 Channel 7 */
.word SAI1_A_IRQHandler /* Serial Audio Interface 1 block A */
.word SAI1_B_IRQHandler /* Serial Audio Interface 1 block B */
.word SAI2_A_IRQHandler /* Serial Audio Interface 2 block A */
.word SAI2_B_IRQHandler /* Serial Audio Interface 2 block B */
.word I2C1_EV_IRQHandler /* I2C1 Event */
.word I2C1_ER_IRQHandler /* I2C1 Error */
.word I2C2_EV_IRQHandler /* I2C2 Event */
.word I2C2_ER_IRQHandler /* I2C2 Error */
.word I2C3_EV_IRQHandler /* I2C3 Event */
.word I2C3_ER_IRQHandler /* I2C3 Error */
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word USART3_IRQHandler /* USART3 */
.word UART4_IRQHandler /* UART4 */
.word UART5_IRQHandler /* UART5 */
.word UART7_IRQHandler /* UART7 */
.word UART8_IRQHandler /* UART8 */
.word I3C1_EV_IRQHandler /* I3C1 Event */
.word I3C1_ER_IRQHandler /* I3C1 Error */
.word OTG_HS_IRQHandler /* USB OTG HS */
.word ETH_IRQHandler /* Ethernet */
.word CORDIC_IRQHandler /* CORDIC */
.word GFXTIM_IRQHandler /* GFXTIM */
.word DCMIPP_IRQHandler /* DCMIPP */
.word LTDC_IRQHandler /* LTDC */
.word LTDC_ER_IRQHandler /* LTDC error */
.word DMA2D_IRQHandler /* DMA2D */
.word JPEG_IRQHandler /* JPEG */
.word GFXMMU_IRQHandler /* GFXMMU */
.word I3C1_WKUP_IRQHandler /* I3C1 wakeup */
.word MCE1_IRQHandler /* MCE1 */
.word MCE2_IRQHandler /* MCE2 */
.word MCE3_IRQHandler /* MCE3 */
.word XSPI1_IRQHandler /* XSPI1 */
.word XSPI2_IRQHandler /* XSPI2 */
.word FMC_IRQHandler /* FMC */
.word SDMMC1_IRQHandler /* SDMMC1 */
.word SDMMC2_IRQHandler /* SDMMC2 */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word OTG_FS_IRQHandler /* USB OTG FS */
.word TIM12_IRQHandler /* TIM12 */
.word TIM13_IRQHandler /* TIM13 */
.word TIM14_IRQHandler /* TIM14 */
.word TIM15_IRQHandler /* TIM15 */
.word TIM16_IRQHandler /* TIM16 */
.word TIM17_IRQHandler /* TIM17 */
.word LPTIM1_IRQHandler /* LP TIM1 */
.word LPTIM2_IRQHandler /* LP TIM2 */
.word LPTIM3_IRQHandler /* LP TIM3 */
.word LPTIM4_IRQHandler /* LP TIM4 */
.word LPTIM5_IRQHandler /* LP TIM5 */
.word SPDIF_RX_IRQHandler /* SPDIF_RX */
.word MDIOS_IRQHandler /* MDIOS */
.word ADF1_FLT0_IRQHandler /* ADF1 Filter 0 */
.word CRS_IRQHandler /* CRS */
.word UCPD1_IRQHandler /* UCPD1 */
.word CEC_IRQHandler /* HDMI_CEC */
.word PSSI_IRQHandler /* PSSI */
.word LPUART1_IRQHandler /* LP UART1 */
.word WAKEUP_PIN_IRQHandler /* Wake-up pins interrupt */
.word GPDMA1_Channel8_IRQHandler /* GPDMA1 Channel 8 */
.word GPDMA1_Channel9_IRQHandler /* GPDMA1 Channel 9 */
.word GPDMA1_Channel10_IRQHandler /* GPDMA1 Channel 10 */
.word GPDMA1_Channel11_IRQHandler /* GPDMA1 Channel 11 */
.word GPDMA1_Channel12_IRQHandler /* GPDMA1 Channel 12 */
.word GPDMA1_Channel13_IRQHandler /* GPDMA1 Channel 13 */
.word GPDMA1_Channel14_IRQHandler /* GPDMA1 Channel 14 */
.word GPDMA1_Channel15_IRQHandler /* GPDMA1 Channel 15 */
.word HPDMA1_Channel8_IRQHandler /* HPDMA1 Channel 8 */
.word HPDMA1_Channel9_IRQHandler /* HPDMA1 Channel 9 */
.word HPDMA1_Channel10_IRQHandler /* HPDMA1 Channel 10 */
.word HPDMA1_Channel11_IRQHandler /* HPDMA1 Channel 11 */
.word HPDMA1_Channel12_IRQHandler /* HPDMA1 Channel 12 */
.word HPDMA1_Channel13_IRQHandler /* HPDMA1 Channel 13 */
.word HPDMA1_Channel14_IRQHandler /* HPDMA1 Channel 14 */
.word HPDMA1_Channel15_IRQHandler /* HPDMA1 Channel 15 */
.word GPU2D_IRQHandler /* GPU2D */
.word GPU2D_ER_IRQHandler /* GPU2D error */
.word ICACHE_IRQHandler /* ICACHE */
.word FDCAN1_IT0_IRQHandler /* FDCAN1 Interrupt 0 */
.word FDCAN1_IT1_IRQHandler /* FDCAN1 Interrupt 1 */
.word FDCAN2_IT0_IRQHandler /* FDCAN2 Interrupt 0 */
.word FDCAN2_IT1_IRQHandler /* FDCAN2 Interrupt 1 */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak PVD_PVM_IRQHandler
.thumb_set PVD_PVM_IRQHandler,Default_Handler
.weak DTS_IRQHandler
.thumb_set DTS_IRQHandler,Default_Handler
.weak IWDG_IRQHandler
.thumb_set IWDG_IRQHandler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RAMECC_IRQHandler
.thumb_set RAMECC_IRQHandler,Default_Handler
.weak FPU_IRQHandler
.thumb_set FPU_IRQHandler,Default_Handler
.weak TAMP_IRQHandler
.thumb_set TAMP_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak EXTI5_IRQHandler
.thumb_set EXTI5_IRQHandler,Default_Handler
.weak EXTI6_IRQHandler
.thumb_set EXTI6_IRQHandler,Default_Handler
.weak EXTI7_IRQHandler
.thumb_set EXTI7_IRQHandler,Default_Handler
.weak EXTI8_IRQHandler
.thumb_set EXTI8_IRQHandler,Default_Handler
.weak EXTI9_IRQHandler
.thumb_set EXTI9_IRQHandler,Default_Handler
.weak EXTI10_IRQHandler
.thumb_set EXTI10_IRQHandler,Default_Handler
.weak EXTI11_IRQHandler
.thumb_set EXTI11_IRQHandler,Default_Handler
.weak EXTI12_IRQHandler
.thumb_set EXTI12_IRQHandler,Default_Handler
.weak EXTI13_IRQHandler
.thumb_set EXTI13_IRQHandler,Default_Handler
.weak EXTI14_IRQHandler
.thumb_set EXTI14_IRQHandler,Default_Handler
.weak EXTI15_IRQHandler
.thumb_set EXTI15_IRQHandler,Default_Handler
.weak RTC_IRQHandler
.thumb_set RTC_IRQHandler,Default_Handler
.weak SAES_IRQHandler
.thumb_set SAES_IRQHandler,Default_Handler
.weak CRYP_IRQHandler
.thumb_set CRYP_IRQHandler,Default_Handler
.weak PKA_IRQHandler
.thumb_set PKA_IRQHandler,Default_Handler
.weak HASH_IRQHandler
.thumb_set HASH_IRQHandler,Default_Handler
.weak RNG_IRQHandler
.thumb_set RNG_IRQHandler,Default_Handler
.weak ADC1_2_IRQHandler
.thumb_set ADC1_2_IRQHandler,Default_Handler
.weak GPDMA1_Channel0_IRQHandler
.thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler
.weak GPDMA1_Channel1_IRQHandler
.thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler
.weak GPDMA1_Channel2_IRQHandler
.thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler
.weak GPDMA1_Channel3_IRQHandler
.thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler
.weak GPDMA1_Channel4_IRQHandler
.thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler
.weak GPDMA1_Channel5_IRQHandler
.thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler
.weak GPDMA1_Channel6_IRQHandler
.thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler
.weak GPDMA1_Channel7_IRQHandler
.thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler
.weak TIM1_BRK_IRQHandler
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
.weak TIM1_UP_IRQHandler
.thumb_set TIM1_UP_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_IRQHandler
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak TIM5_IRQHandler
.thumb_set TIM5_IRQHandler,Default_Handler
.weak TIM6_IRQHandler
.thumb_set TIM6_IRQHandler,Default_Handler
.weak TIM7_IRQHandler
.thumb_set TIM7_IRQHandler,Default_Handler
.weak TIM9_IRQHandler
.thumb_set TIM9_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak SPI3_IRQHandler
.thumb_set SPI3_IRQHandler,Default_Handler
.weak SPI4_IRQHandler
.thumb_set SPI4_IRQHandler,Default_Handler
.weak SPI5_IRQHandler
.thumb_set SPI5_IRQHandler,Default_Handler
.weak SPI6_IRQHandler
.thumb_set SPI6_IRQHandler,Default_Handler
.weak HPDMA1_Channel0_IRQHandler
.thumb_set HPDMA1_Channel0_IRQHandler,Default_Handler
.weak HPDMA1_Channel1_IRQHandler
.thumb_set HPDMA1_Channel1_IRQHandler,Default_Handler
.weak HPDMA1_Channel2_IRQHandler
.thumb_set HPDMA1_Channel2_IRQHandler,Default_Handler
.weak HPDMA1_Channel3_IRQHandler
.thumb_set HPDMA1_Channel3_IRQHandler,Default_Handler
.weak HPDMA1_Channel4_IRQHandler
.thumb_set HPDMA1_Channel4_IRQHandler,Default_Handler
.weak HPDMA1_Channel5_IRQHandler
.thumb_set HPDMA1_Channel5_IRQHandler,Default_Handler
.weak HPDMA1_Channel6_IRQHandler
.thumb_set HPDMA1_Channel6_IRQHandler,Default_Handler
.weak HPDMA1_Channel7_IRQHandler
.thumb_set HPDMA1_Channel7_IRQHandler,Default_Handler
.weak SAI1_A_IRQHandler
.thumb_set SAI1_A_IRQHandler,Default_Handler
.weak SAI1_B_IRQHandler
.thumb_set SAI1_B_IRQHandler,Default_Handler
.weak SAI2_A_IRQHandler
.thumb_set SAI2_A_IRQHandler,Default_Handler
.weak SAI2_B_IRQHandler
.thumb_set SAI2_B_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak I2C3_EV_IRQHandler
.thumb_set I2C3_EV_IRQHandler,Default_Handler
.weak I2C3_ER_IRQHandler
.thumb_set I2C3_ER_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak UART4_IRQHandler
.thumb_set UART4_IRQHandler,Default_Handler
.weak UART5_IRQHandler
.thumb_set UART5_IRQHandler,Default_Handler
.weak UART7_IRQHandler
.thumb_set UART7_IRQHandler,Default_Handler
.weak UART8_IRQHandler
.thumb_set UART8_IRQHandler,Default_Handler
.weak I3C1_EV_IRQHandler
.thumb_set I3C1_EV_IRQHandler,Default_Handler
.weak I3C1_ER_IRQHandler
.thumb_set I3C1_ER_IRQHandler,Default_Handler
.weak OTG_HS_IRQHandler
.thumb_set OTG_HS_IRQHandler,Default_Handler
.weak ETH_IRQHandler
.thumb_set ETH_IRQHandler,Default_Handler
.weak CORDIC_IRQHandler
.thumb_set CORDIC_IRQHandler,Default_Handler
.weak GFXTIM_IRQHandler
.thumb_set GFXTIM_IRQHandler,Default_Handler
.weak DCMIPP_IRQHandler
.thumb_set DCMIPP_IRQHandler,Default_Handler
.weak LTDC_IRQHandler
.thumb_set LTDC_IRQHandler,Default_Handler
.weak LTDC_ER_IRQHandler
.thumb_set LTDC_ER_IRQHandler,Default_Handler
.weak DMA2D_IRQHandler
.thumb_set DMA2D_IRQHandler,Default_Handler
.weak JPEG_IRQHandler
.thumb_set JPEG_IRQHandler,Default_Handler
.weak GFXMMU_IRQHandler
.thumb_set GFXMMU_IRQHandler,Default_Handler
.weak I3C1_WKUP_IRQHandler
.thumb_set I3C1_WKUP_IRQHandler,Default_Handler
.weak MCE1_IRQHandler
.thumb_set MCE1_IRQHandler,Default_Handler
.weak MCE2_IRQHandler
.thumb_set MCE2_IRQHandler,Default_Handler
.weak MCE3_IRQHandler
.thumb_set MCE3_IRQHandler,Default_Handler
.weak XSPI1_IRQHandler
.thumb_set XSPI1_IRQHandler,Default_Handler
.weak XSPI2_IRQHandler
.thumb_set XSPI2_IRQHandler,Default_Handler
.weak FMC_IRQHandler
.thumb_set FMC_IRQHandler,Default_Handler
.weak SDMMC1_IRQHandler
.thumb_set SDMMC1_IRQHandler,Default_Handler
.weak SDMMC2_IRQHandler
.thumb_set SDMMC2_IRQHandler,Default_Handler
.weak OTG_FS_IRQHandler
.thumb_set OTG_FS_IRQHandler,Default_Handler
.weak TIM12_IRQHandler
.thumb_set TIM12_IRQHandler,Default_Handler
.weak TIM13_IRQHandler
.thumb_set TIM13_IRQHandler,Default_Handler
.weak TIM14_IRQHandler
.thumb_set TIM14_IRQHandler,Default_Handler
.weak TIM15_IRQHandler
.thumb_set TIM15_IRQHandler,Default_Handler
.weak TIM16_IRQHandler
.thumb_set TIM16_IRQHandler,Default_Handler
.weak TIM17_IRQHandler
.thumb_set TIM17_IRQHandler,Default_Handler
.weak LPTIM1_IRQHandler
.thumb_set LPTIM1_IRQHandler,Default_Handler
.weak LPTIM2_IRQHandler
.thumb_set LPTIM2_IRQHandler,Default_Handler
.weak LPTIM3_IRQHandler
.thumb_set LPTIM3_IRQHandler,Default_Handler
.weak LPTIM4_IRQHandler
.thumb_set LPTIM4_IRQHandler,Default_Handler
.weak LPTIM5_IRQHandler
.thumb_set LPTIM5_IRQHandler,Default_Handler
.weak SPDIF_RX_IRQHandler
.thumb_set SPDIF_RX_IRQHandler,Default_Handler
.weak MDIOS_IRQHandler
.thumb_set MDIOS_IRQHandler,Default_Handler
.weak ADF1_FLT0_IRQHandler
.thumb_set ADF1_FLT0_IRQHandler,Default_Handler
.weak CRS_IRQHandler
.thumb_set CRS_IRQHandler,Default_Handler
.weak UCPD1_IRQHandler
.thumb_set UCPD1_IRQHandler,Default_Handler
.weak CEC_IRQHandler
.thumb_set CEC_IRQHandler,Default_Handler
.weak PSSI_IRQHandler
.thumb_set PSSI_IRQHandler,Default_Handler
.weak LPUART1_IRQHandler
.thumb_set LPUART1_IRQHandler,Default_Handler
.weak WAKEUP_PIN_IRQHandler
.thumb_set WAKEUP_PIN_IRQHandler,Default_Handler
.weak GPDMA1_Channel8_IRQHandler
.thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler
.weak GPDMA1_Channel9_IRQHandler
.thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler
.weak GPDMA1_Channel10_IRQHandler
.thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler
.weak GPDMA1_Channel11_IRQHandler
.thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler
.weak GPDMA1_Channel12_IRQHandler
.thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler
.weak GPDMA1_Channel13_IRQHandler
.thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler
.weak GPDMA1_Channel14_IRQHandler
.thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler
.weak GPDMA1_Channel15_IRQHandler
.thumb_set GPDMA1_Channel15_IRQHandler,Default_Handler
.weak HPDMA1_Channel8_IRQHandler
.thumb_set HPDMA1_Channel8_IRQHandler,Default_Handler
.weak HPDMA1_Channel9_IRQHandler
.thumb_set HPDMA1_Channel9_IRQHandler,Default_Handler
.weak HPDMA1_Channel10_IRQHandler
.thumb_set HPDMA1_Channel10_IRQHandler,Default_Handler
.weak HPDMA1_Channel11_IRQHandler
.thumb_set HPDMA1_Channel11_IRQHandler,Default_Handler
.weak HPDMA1_Channel12_IRQHandler
.thumb_set HPDMA1_Channel12_IRQHandler,Default_Handler
.weak HPDMA1_Channel13_IRQHandler
.thumb_set HPDMA1_Channel13_IRQHandler,Default_Handler
.weak HPDMA1_Channel14_IRQHandler
.thumb_set HPDMA1_Channel14_IRQHandler,Default_Handler
.weak HPDMA1_Channel15_IRQHandler
.thumb_set HPDMA1_Channel15_IRQHandler,Default_Handler
.weak GPU2D_IRQHandler
.thumb_set GPU2D_IRQHandler,Default_Handler
.weak GPU2D_ER_IRQHandler
.thumb_set GPU2D_ER_IRQHandler,Default_Handler
.weak ICACHE_IRQHandler
.thumb_set ICACHE_IRQHandler,Default_Handler
.weak FDCAN1_IT0_IRQHandler
.thumb_set FDCAN1_IT0_IRQHandler,Default_Handler
.weak FDCAN1_IT1_IRQHandler
.thumb_set FDCAN1_IT1_IRQHandler,Default_Handler
.weak FDCAN2_IT0_IRQHandler
.thumb_set FDCAN2_IT0_IRQHandler,Default_Handler
.weak FDCAN2_IT1_IRQHandler
.thumb_set FDCAN2_IT1_IRQHandler,Default_Handler
.weak SystemInit
+176
View File
@@ -0,0 +1,176 @@
/**
******************************************************************************
* @file syscalls.c
* @author Auto-generated by STM32CubeIDE
* @brief STM32CubeIDE Minimal System calls file
*
* For more information about which c-functions
* need which of these lowlevel functions
* please consult the Newlib libc-manual
******************************************************************************
* @attention
*
* Copyright (c) 2020-2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes */
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
/* Variables */
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));
char *__env[1] = { 0 };
char **environ = __env;
/* Functions */
void initialise_monitor_handles()
{
}
int _getpid(void)
{
return 1;
}
int _kill(int pid, int sig)
{
(void)pid;
(void)sig;
errno = EINVAL;
return -1;
}
void _exit (int status)
{
_kill(status, -1);
while (1) {} /* Make sure we hang here */
}
__attribute__((weak)) int _read(int file, char *ptr, int len)
{
(void)file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar();
}
return len;
}
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
(void)file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar(*ptr++);
}
return len;
}
int _close(int file)
{
(void)file;
return -1;
}
int _fstat(int file, struct stat *st)
{
(void)file;
st->st_mode = S_IFCHR;
return 0;
}
int _isatty(int file)
{
(void)file;
return 1;
}
int _lseek(int file, int ptr, int dir)
{
(void)file;
(void)ptr;
(void)dir;
return 0;
}
int _open(char *path, int flags, ...)
{
(void)path;
(void)flags;
/* Pretend like we always fail */
return -1;
}
int _wait(int *status)
{
(void)status;
errno = ECHILD;
return -1;
}
int _unlink(char *name)
{
(void)name;
errno = ENOENT;
return -1;
}
int _times(struct tms *buf)
{
(void)buf;
return -1;
}
int _stat(char *file, struct stat *st)
{
(void)file;
st->st_mode = S_IFCHR;
return 0;
}
int _link(char *old, char *new)
{
(void)old;
(void)new;
errno = EMLINK;
return -1;
}
int _fork(void)
{
errno = EAGAIN;
return -1;
}
int _execve(char *name, char **argv, char **env)
{
(void)name;
(void)argv;
(void)env;
errno = ENOMEM;
return -1;
}
+79
View File
@@ -0,0 +1,79 @@
/**
******************************************************************************
* @file sysmem.c
* @author Generated by STM32CubeIDE
* @brief STM32CubeIDE System Memory calls file
*
* For more information about which C functions
* need which of these lowlevel functions
* please consult the newlib libc manual
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes */
#include <errno.h>
#include <stdint.h>
/**
* Pointer to the current high watermark of the heap usage
*/
static uint8_t *__sbrk_heap_end = NULL;
/**
* @brief _sbrk() allocates memory to the newlib heap and is used by malloc
* and others from the C library
*
* @verbatim
* ############################################################################
* # .data # .bss # newlib heap # MSP stack #
* # # # # Reserved by _Min_Stack_Size #
* ############################################################################
* ^-- RAM start ^-- _end _estack, RAM end --^
* @endverbatim
*
* This implementation starts allocating at the '_end' linker symbol
* The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack
* The implementation considers '_estack' linker symbol to be RAM end
* NOTE: If the MSP stack, at any point during execution, grows larger than the
* reserved size, please increase the '_Min_Stack_Size'.
*
* @param incr Memory size
* @return Pointer to allocated memory
*/
void *_sbrk(ptrdiff_t incr)
{
extern uint8_t _end; /* Symbol defined in the linker script */
extern uint8_t _estack; /* Symbol defined in the linker script */
extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */
const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
const uint8_t *max_heap = (uint8_t *)stack_limit;
uint8_t *prev_heap_end;
/* Initialize heap end at first call */
if (NULL == __sbrk_heap_end)
{
__sbrk_heap_end = &_end;
}
/* Protect heap from growing into the reserved MSP stack */
if (__sbrk_heap_end + incr > max_heap)
{
errno = ENOMEM;
return (void *)-1;
}
prev_heap_end = __sbrk_heap_end;
__sbrk_heap_end += incr;
return (void *)prev_heap_end;
}