first commit
This commit is contained in:
commit
92cbe97616
1978 files changed
+1688498
No files matched your search
@@ -0,0 +1,141 @@
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* These parameters and more are described within the 'configuration' section of the
|
||||
* FreeRTOS API documentation available on the FreeRTOS.org web site.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* Section where include file can be added */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Ensure definitions are only used by the compiler, and not by the assembler. */
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
extern uint32_t SystemCoreClock;
|
||||
/* USER CODE BEGIN 0 */
|
||||
extern void configureTimerForRunTimeStats(void);
|
||||
extern unsigned long getRunTimeCounterValue(void);
|
||||
/* USER CODE END 0 */
|
||||
#endif
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_MPU 0
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)1024)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)0x20000)
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configQUEUE_REGISTRY_SIZE ( 32 )
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 8
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 4 )
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
||||
/* Defaults to size_t for backward compatibility, but can be changed
|
||||
if lengths will always be less than the number of bytes in a size_t. */
|
||||
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||
/* USER CODE END MESSAGE_BUFFER_LENGTH_TYPE */
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* The following flag must be enabled only when using newlib */
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#define configCHECK_HANDLER_INSTALLATION 1
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
/* Cortex-M specific definitions. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 4
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* Normal assert() semantics without relying on the provision of an assert.h
|
||||
header file. */
|
||||
/* USER CODE BEGIN 1 */
|
||||
void vAssertCalled( const char * const pcFileName, unsigned long ulLine );
|
||||
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); vAssertCalled( __FILE__, __LINE__);}
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
||||
standard names. */
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
|
||||
/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
|
||||
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
|
||||
|
||||
//#define xPortSysTickHandler SysTick_Handler
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
/* Definitions needed when configGENERATE_RUN_TIME_STATS is on */
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //SetupRunTimeStatsTimer
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() (xTaskGetTickCount())//GetHighFrequencyTickValue
|
||||
|
||||
#define configISR_STACK_SIZE_WORDS 4096
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* USER CODE BEGIN Defines */
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||
#define configRECORD_STACK_HIGH_ADDRESS 1 /* 1: record stack high address for the debugger, 0: do not record stack high address */
|
||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||
|
||||
|
||||
/* USER CODE END Defines */
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* FreeRTOS+TCP
|
||||
* Copyright (C) 2022 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://aws.amazon.com/freertos
|
||||
* http://www.FreeRTOS.org
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_IP_CONFIG_H
|
||||
#define FREERTOS_IP_CONFIG_H
|
||||
|
||||
#define ipconfigUSE_IPv4 ( 1 )
|
||||
|
||||
#define ipconfigUSE_IPv6 ( 0 )
|
||||
|
||||
#define ipconfigUSE_DHCPv6 0
|
||||
#define ipconfigIPv4_BACKWARD_COMPATIBLE 0
|
||||
#define ipconfigUSE_ARP_REVERSED_LOOKUP 1
|
||||
#define ipconfigUSE_LOOPBACK 0
|
||||
#define ipconfigUSE_ARP_REMOVE_ENTRY 1
|
||||
#define ipconfigARP_STORES_REMOTE_ADDRESSES 1
|
||||
#define ipconfigUSE_LINKED_RX_MESSAGES 1
|
||||
#define ipconfigFORCE_IP_DONT_FRAGMENT 1
|
||||
#define ipconfigUSE_DHCP 1
|
||||
#define ipconfigDHCP_FALL_BACK_AUTO_IP 1
|
||||
#define ipconfigARP_USE_CLASH_DETECTION 1
|
||||
#define ipconfigUSE_LLMNR 0
|
||||
#define ipconfigUSE_NBNS 0
|
||||
#define ipconfigUSE_MDNS 0
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 1
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_PACKETS 0
|
||||
#define ipconfigZERO_COPY_TX_DRIVER 1
|
||||
#define ipconfigZERO_COPY_RX_DRIVER 1
|
||||
#define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 1
|
||||
#define ipconfigSOCKET_HAS_USER_SEMAPHORE 1
|
||||
#define ipconfigSELECT_USES_NOTIFY 1
|
||||
#define ipconfigSUPPORT_SIGNALS 1
|
||||
#define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 0
|
||||
#define ipconfigDNS_USE_CALLBACKS 0
|
||||
#define ipconfigIGNORE_UNKNOWN_PACKETS 1
|
||||
#define ipconfigCHECK_IP_QUEUE_SPACE 1
|
||||
#define ipconfigUDP_MAX_RX_PACKETS 1
|
||||
#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1
|
||||
#define ipconfigTCP_IP_SANITY 1
|
||||
#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1
|
||||
|
||||
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
|
||||
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
|
||||
* out the debugging messages. */
|
||||
#define ipconfigHAS_DEBUG_PRINTF 0
|
||||
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
|
||||
#define FreeRTOS_debug_printf( X ) printf X
|
||||
#endif
|
||||
|
||||
/* Set to 1 to print out non debugging messages, for example the output of the
|
||||
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
|
||||
* then FreeRTOS_printf should be set to the function used to print out the
|
||||
* messages. */
|
||||
#define ipconfigHAS_PRINTF 0
|
||||
#if ( ipconfigHAS_PRINTF == 1 )
|
||||
#define FreeRTOS_printf( X ) printf X
|
||||
#endif
|
||||
|
||||
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
|
||||
* on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
|
||||
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
|
||||
|
||||
/* If the network card/driver includes checksum offloading then set
|
||||
* ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
|
||||
* stack repeating the checksum calculations. */
|
||||
#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
|
||||
|
||||
/* Several API's will block until the result is known, or the action has been
|
||||
* performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
|
||||
* set per socket, using setsockopt(). If not set, the times below will be
|
||||
* used as defaults. */
|
||||
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for DNS caching. For TCP, having a small DNS cache is very
|
||||
* useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
|
||||
* and also DNS may use small timeouts. If a DNS reply comes in after the DNS
|
||||
* socket has been destroyed, the result will be stored into the cache. The next
|
||||
* call to FreeRTOS_gethostbyname() will return immediately, without even creating
|
||||
* a socket.
|
||||
*/
|
||||
#define ipconfigUSE_DNS_CACHE ( 1 )
|
||||
#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 6 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* The IP stack executes it its own task (although any application task can make
|
||||
* use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
|
||||
* sets the priority of the task that executes the IP stack. The priority is a
|
||||
* standard FreeRTOS task priority so can take any value from 0 (the lowest
|
||||
* priority) to (configMAX_PRIORITIES - 1) (the highest priority).
|
||||
* configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
|
||||
* FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
|
||||
* the priority assigned to the task executing the IP stack relative to the
|
||||
* priority assigned to tasks that use the IP stack. */
|
||||
#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
|
||||
* task. This setting is less important when the FreeRTOS Win32 simulator is used
|
||||
* as the Win32 simulator only stores a fixed amount of information on the task
|
||||
* stack. FreeRTOS includes optional stack overflow detection, see:
|
||||
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */
|
||||
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
|
||||
|
||||
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
|
||||
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
|
||||
* is not set to 1 then the network event hook will never be called. See:
|
||||
* https://freertos.org/Documentation/03-Libraries/02-FreeRTOS-plus/02-FreeRTOS-plus-TCP/09-API-reference/57-vApplicationIPNetworkEventHook.
|
||||
*/
|
||||
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
|
||||
|
||||
/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
|
||||
* a network buffer cannot be obtained then the calling task is held in the Blocked
|
||||
* state (so other tasks can continue to executed) until either a network buffer
|
||||
* becomes available or the send block time expires. If the send block time expires
|
||||
* then the send operation is aborted. The maximum allowable send block time is
|
||||
* capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
|
||||
* maximum allowable send block time prevents prevents a deadlock occurring when
|
||||
* all the network buffers are in use and the tasks that process (and subsequently
|
||||
* free) the network buffers are themselves blocked waiting for a network buffer.
|
||||
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
|
||||
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
|
||||
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )
|
||||
|
||||
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
|
||||
* address, netmask, DNS server address and gateway address from a DHCP server. If
|
||||
* ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
|
||||
* stack will revert to using the static IP address even when ipconfigUSE_DHCP is
|
||||
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
|
||||
* reason. The static configuration used is that passed into the stack by the
|
||||
* FreeRTOS_IPInit() function call. */
|
||||
#define ipconfigUSE_DHCP 1
|
||||
#define ipconfigDHCP_REGISTER_HOSTNAME 1
|
||||
#define ipconfigDHCP_USES_UNICAST 1
|
||||
|
||||
/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must
|
||||
* provide an implementation of the DHCP callback function,
|
||||
* xApplicationDHCPUserHook(). */
|
||||
#define ipconfigUSE_DHCP_HOOK 1
|
||||
|
||||
/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
|
||||
* increasing time intervals until either a reply is received from a DHCP server
|
||||
* and accepted, or the interval between transmissions reaches
|
||||
* ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
|
||||
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
|
||||
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
|
||||
* a DHCP reply being received. */
|
||||
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 120000U )
|
||||
|
||||
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
|
||||
* stack can only send a UDP message to a remove IP address if it knowns the MAC
|
||||
* address associated with the IP address, or the MAC address of the router used to
|
||||
* contact the remote IP address. When a UDP message is received from a remote IP
|
||||
* address the MAC address and IP address are added to the ARP cache. When a UDP
|
||||
* message is sent to a remote IP address that does not already appear in the ARP
|
||||
* cache then the UDP message is replaced by a ARP message that solicits the
|
||||
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
|
||||
* number of entries that can exist in the ARP table at any one time. */
|
||||
#define ipconfigARP_CACHE_ENTRIES 6
|
||||
|
||||
/* ARP requests that do not result in an ARP response will be re-transmitted a
|
||||
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
|
||||
* aborted. */
|
||||
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
|
||||
|
||||
/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
|
||||
* table being created or refreshed and the entry being removed because it is stale.
|
||||
* New ARP requests are sent for ARP cache entries that are nearing their maximum
|
||||
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
|
||||
* equal to 1500 seconds (or 25 minutes). */
|
||||
#define ipconfigMAX_ARP_AGE 150
|
||||
|
||||
/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
|
||||
* routines, which are relatively large. To save code space the full
|
||||
* FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
|
||||
* alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
|
||||
* takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
|
||||
* FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
|
||||
* (for example, 192, 168, 0, 1) as its parameters. If
|
||||
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
|
||||
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
|
||||
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
|
||||
#define ipconfigINCLUDE_FULL_INET_ADDR 1
|
||||
|
||||
/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
|
||||
* are available to the IP stack. The total number of network buffers is limited
|
||||
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
|
||||
* to a pre-determinable value. */
|
||||
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 20
|
||||
|
||||
/* A FreeRTOS queue is used to send events from application tasks to the IP
|
||||
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
|
||||
* be queued for processing at any one time. The event queue must be a minimum of
|
||||
* 5 greater than the total number of network buffers. */
|
||||
#define ipconfigEVENT_QUEUE_LENGTH \
|
||||
( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
|
||||
|
||||
/* The address of a socket is the combination of its IP address and its port
|
||||
* number. FreeRTOS_bind() is used to manually allocate a port number to a socket
|
||||
* (to 'bind' the socket to a port), but manual binding is not normally necessary
|
||||
* for client sockets (those sockets that initiate outgoing connections rather than
|
||||
* wait for incoming connections on a known port number). If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
|
||||
* FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
|
||||
* stack automatically binding the socket to a port number from the range
|
||||
* socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
|
||||
* on a socket that has not yet been bound will result in the send operation being
|
||||
* aborted. */
|
||||
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
|
||||
|
||||
/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
|
||||
#define ipconfigUDP_TIME_TO_LIVE 128
|
||||
/* Also defined in FreeRTOSIPConfigDefaults.h. */
|
||||
#define ipconfigTCP_TIME_TO_LIVE 128
|
||||
|
||||
/* USE_TCP: Use TCP and all its features. */
|
||||
#define ipconfigUSE_TCP ( 0 )
|
||||
|
||||
/* USE_WIN: Let TCP use windowing mechanism. */
|
||||
#define ipconfigUSE_TCP_WIN ( 1 )
|
||||
|
||||
/* The MTU is the maximum number of bytes the payload of a network frame can
|
||||
* contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
|
||||
* lower value can save RAM, depending on the buffer management scheme used. If
|
||||
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
|
||||
* be divisible by 8. */
|
||||
#define ipconfigNETWORK_MTU 1500U
|
||||
|
||||
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
|
||||
* through the FreeRTOS_gethostbyname() API function. */
|
||||
#define ipconfigUSE_DNS 1
|
||||
|
||||
/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
|
||||
* generate replies to incoming ICMP echo (ping) requests. */
|
||||
#define ipconfigREPLY_TO_INCOMING_PINGS 1
|
||||
|
||||
/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
|
||||
* FreeRTOS_SendPingRequest() API function is available. */
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 1
|
||||
|
||||
/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
|
||||
* (and associated) API function is available. */
|
||||
#define ipconfigSUPPORT_SELECT_FUNCTION 1
|
||||
|
||||
/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
|
||||
* that are not in Ethernet II format will be dropped. This option is included for
|
||||
* potential future IP stack developments. */
|
||||
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
|
||||
|
||||
/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
|
||||
* responsibility of the Ethernet interface to filter out packets that are of no
|
||||
* interest. If the Ethernet interface does not implement this functionality, then
|
||||
* set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
|
||||
* perform the filtering instead (it is much less efficient for the stack to do it
|
||||
* because the packet will already have been passed into the stack). If the
|
||||
* Ethernet driver does all the necessary filtering in hardware then software
|
||||
* filtering can be removed by using a value other than 1 or 0. */
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
|
||||
/* The windows simulator cannot really simulate MAC interrupts, and needs to
|
||||
* block occasionally to allow other tasks to run. */
|
||||
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY pdMS_TO_TICKS( 20 )
|
||||
|
||||
/* Advanced only: in order to access 32-bit fields in the IP packets with
|
||||
* 32-bit memory instructions, all packets will be stored 32-bit-aligned,
|
||||
* plus 16-bits. This has to do with the contents of the IP-packets: all
|
||||
* 32-bit fields are 32-bit-aligned, plus 16-bit. */
|
||||
#define ipconfigPACKET_FILLER_SIZE 2U
|
||||
|
||||
/* Define the size of the pool of TCP window descriptors. On the average, each
|
||||
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
|
||||
* outstanding packets (for Rx and Tx). When using up to 10 TP sockets
|
||||
* simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
|
||||
#define ipconfigTCP_WIN_SEG_COUNT 240
|
||||
|
||||
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
|
||||
* maximum size. Define the size of Rx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_RX_BUFFER_LENGTH ( 10000 )
|
||||
|
||||
/* Define the size of Tx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_TX_BUFFER_LENGTH ( 10000 )
|
||||
|
||||
/* When using call-back handlers, the driver may check if the handler points to
|
||||
* real program memory (RAM or flash) or just has a random non-zero value. */
|
||||
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
|
||||
|
||||
/* Include support for TCP keep-alive messages. */
|
||||
#define ipconfigTCP_KEEP_ALIVE ( 1 )
|
||||
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* Seconds. */
|
||||
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 )
|
||||
#define ipconfigUSE_CALLBACKS ( 1 )
|
||||
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#define ipconfigISO_STRICTNESS_VIOLATION_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||
|
||||
#define ipconfigISO_STRICTNESS_VIOLATION_END _Pragma("GCC diagnostic pop")
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* ipc_eth_consumer.h
|
||||
*
|
||||
* Created on: 11.08.2026
|
||||
* Author: Thorsten
|
||||
*/
|
||||
|
||||
#ifndef INC_IPC_IPC_ETH_CONSUMER_H_
|
||||
#define INC_IPC_IPC_ETH_CONSUMER_H_
|
||||
|
||||
typedef struct IPC_ETH_CONSUMER_Context *IPC_ETH_CONSUMER_Context_t;
|
||||
|
||||
typedef struct IPC_ETH_CONSUMER_Handle
|
||||
{
|
||||
IPC_ETH_CONSUMER_Context_t priv;
|
||||
struct
|
||||
{
|
||||
|
||||
} functions;
|
||||
} *IPC_ETH_CONSUMER_Handle_t;
|
||||
|
||||
IPC_ETH_CONSUMER_Handle_t IPC_ETH_CONSUMER_Init(const char *endpoint);
|
||||
|
||||
#endif /* INC_IPC_IPC_ETH_CONSUMER_H_ */
|
||||
@@ -0,0 +1,69 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
@@ -0,0 +1,520 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_hal_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef STM32H7xx_HAL_CONF_H_PRE
|
||||
#define STM32H7xx_HAL_CONF_H_PRE
|
||||
|
||||
#define ETH_RX_BUF_SIZE 1526
|
||||
|
||||
#endif
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H7xx_HAL_CONF_H
|
||||
#define STM32H7xx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#define HAL_MODULE_ENABLED
|
||||
|
||||
/* #define HAL_ADC_MODULE_ENABLED */
|
||||
/* #define HAL_FDCAN_MODULE_ENABLED */
|
||||
/* #define HAL_FMAC_MODULE_ENABLED */
|
||||
/* #define HAL_CEC_MODULE_ENABLED */
|
||||
/* #define HAL_COMP_MODULE_ENABLED */
|
||||
/* #define HAL_CORDIC_MODULE_ENABLED */
|
||||
/* #define HAL_CRC_MODULE_ENABLED */
|
||||
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||
/* #define HAL_DAC_MODULE_ENABLED */
|
||||
/* #define HAL_DCMI_MODULE_ENABLED */
|
||||
/* #define HAL_DMA2D_MODULE_ENABLED */
|
||||
#define HAL_ETH_MODULE_ENABLED
|
||||
/* #define HAL_ETH_LEGACY_MODULE_ENABLED */
|
||||
/* #define HAL_NAND_MODULE_ENABLED */
|
||||
/* #define HAL_NOR_MODULE_ENABLED */
|
||||
/* #define HAL_OTFDEC_MODULE_ENABLED */
|
||||
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||
/* #define HAL_HASH_MODULE_ENABLED */
|
||||
/* #define HAL_HRTIM_MODULE_ENABLED */
|
||||
/* #define HAL_HSEM_MODULE_ENABLED */
|
||||
/* #define HAL_GFXMMU_MODULE_ENABLED */
|
||||
/* #define HAL_JPEG_MODULE_ENABLED */
|
||||
/* #define HAL_OPAMP_MODULE_ENABLED */
|
||||
/* #define HAL_OSPI_MODULE_ENABLED */
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||
/* #define HAL_RAMECC_MODULE_ENABLED */
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_SWPMI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
/* #define HAL_UART_MODULE_ENABLED */
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
/* #define HAL_PCD_MODULE_ENABLED */
|
||||
/* #define HAL_HCD_MODULE_ENABLED */
|
||||
/* #define HAL_DFSDM_MODULE_ENABLED */
|
||||
/* #define HAL_DSI_MODULE_ENABLED */
|
||||
/* #define HAL_JPEG_MODULE_ENABLED */
|
||||
/* #define HAL_MDIOS_MODULE_ENABLED */
|
||||
/* #define HAL_PSSI_MODULE_ENABLED */
|
||||
/* #define HAL_DTS_MODULE_ENABLED */
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_MDMA_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_EXTI_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_I2C_MODULE_ENABLED
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
#define HAL_HSEM_MODULE_ENABLED
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE (8000000UL) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal oscillator (CSI) default value.
|
||||
* This value is the default CSI value after Reset.
|
||||
*/
|
||||
#if !defined (CSI_VALUE)
|
||||
#define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* CSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE (64000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */
|
||||
#endif /* LSE_STARTUP_TIMEOUT */
|
||||
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
in voltage and temperature.*/
|
||||
|
||||
/**
|
||||
* @brief External clock source for I2S peripheral
|
||||
* This value is used by the I2S HAL module to compute the I2S clock source
|
||||
* frequency, this source is inserted directly through I2S_CKIN pad.
|
||||
*/
|
||||
#if !defined (EXTERNAL_CLOCK_VALUE)
|
||||
#define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in Hz*/
|
||||
#endif /* EXTERNAL_CLOCK_VALUE */
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY (15UL) /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0
|
||||
#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */
|
||||
#define USE_SPI_CRC 0U /*!< use CRC in SPI */
|
||||
|
||||
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
|
||||
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
|
||||
#define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */
|
||||
#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U /* CORDIC register callback disabled */
|
||||
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */
|
||||
#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
|
||||
#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */
|
||||
#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */
|
||||
#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */
|
||||
#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */
|
||||
#define USE_HAL_DTS_REGISTER_CALLBACKS 0U /* DTS register callback disabled */
|
||||
#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */
|
||||
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */
|
||||
#define USE_HAL_FMAC_REGISTER_CALLBACKS 0U /* FMAC register callback disabled */
|
||||
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
|
||||
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
|
||||
#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */
|
||||
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
|
||||
#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */
|
||||
#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */
|
||||
#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U /* GFXMMU register callback disabled */
|
||||
#define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */
|
||||
#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */
|
||||
#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */
|
||||
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */
|
||||
#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */
|
||||
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */
|
||||
#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */
|
||||
#define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
|
||||
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */
|
||||
#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
|
||||
#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U /* OSPI register callback disabled */
|
||||
#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */
|
||||
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */
|
||||
#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */
|
||||
#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */
|
||||
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */
|
||||
#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */
|
||||
#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */
|
||||
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */
|
||||
#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */
|
||||
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
|
||||
#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
|
||||
|
||||
/* ########################### Ethernet Configuration ######################### */
|
||||
#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */
|
||||
#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */
|
||||
|
||||
#define ETH_MAC_ADDR0 (0x02UL)
|
||||
#define ETH_MAC_ADDR1 (0x00UL)
|
||||
#define ETH_MAC_ADDR2 (0x00UL)
|
||||
#define ETH_MAC_ADDR3 (0x00UL)
|
||||
#define ETH_MAC_ADDR4 (0x00UL)
|
||||
#define ETH_MAC_ADDR5 (0x00UL)
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MDMA_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_mdma.h"
|
||||
#endif /* HAL_MDMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HASH_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_hash.h"
|
||||
#endif /* HAL_HASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DCMI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dcmi.h"
|
||||
#endif /* HAL_DCMI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dma2d.h"
|
||||
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DSI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dsi.h"
|
||||
#endif /* HAL_DSI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DFSDM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dfsdm.h"
|
||||
#endif /* HAL_DFSDM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DTS_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dts.h"
|
||||
#endif /* HAL_DTS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ETH_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_eth.h"
|
||||
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ETH_LEGACY_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_eth_legacy.h"
|
||||
#endif /* HAL_ETH_LEGACY_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_adc.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_fdcan.h"
|
||||
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_cec.h"
|
||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_comp.h"
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORDIC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_cordic.h"
|
||||
#endif /* HAL_CORDIC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_dac.h"
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GFXMMU_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_gfxmmu.h"
|
||||
#endif /* HAL_GFXMMU_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FMAC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_fmac.h"
|
||||
#endif /* HAL_FMAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HRTIM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_hrtim.h"
|
||||
#endif /* HAL_HRTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HSEM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_hsem.h"
|
||||
#endif /* HAL_HSEM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_sram.h"
|
||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NOR_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_nor.h"
|
||||
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NAND_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_nand.h"
|
||||
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_JPEG_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_jpeg.h"
|
||||
#endif /* HAL_JPEG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MDIOS_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_mdios.h"
|
||||
#endif /* HAL_MDIOS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MMC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_mmc.h"
|
||||
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_lptim.h"
|
||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LTDC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_ltdc.h"
|
||||
#endif /* HAL_LTDC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_OPAMP_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_opamp.h"
|
||||
#endif /* HAL_OPAMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_OSPI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_ospi.h"
|
||||
#endif /* HAL_OSPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_OTFDEC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_otfdec.h"
|
||||
#endif /* HAL_OTFDEC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PSSI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_pssi.h"
|
||||
#endif /* HAL_PSSI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_QSPI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_qspi.h"
|
||||
#endif /* HAL_QSPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RAMECC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_ramecc.h"
|
||||
#endif /* HAL_RAMECC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RNG_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_rng.h"
|
||||
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SAI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_sai.h"
|
||||
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SD_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_sd.h"
|
||||
#endif /* HAL_SD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_sdram.h"
|
||||
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_spdifrx.h"
|
||||
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SWPMI_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_swpmi.h"
|
||||
#endif /* HAL_SWPMI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_smbus.h"
|
||||
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_pcd.h"
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HCD_MODULE_ENABLED
|
||||
#include "stm32h7xx_hal_hcd.h"
|
||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t *file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32H7xx_HAL_CONF_H */
|
||||
@@ -0,0 +1,69 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32H7xx_IT_H
|
||||
#define __STM32H7xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void ETH_IRQHandler(void);
|
||||
void CM7_SEV_IRQHandler(void);
|
||||
void HSEM2_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32H7xx_IT_H */
|
||||
@@ -0,0 +1,466 @@
|
||||
/*
|
||||
* ipc_eth_consumer.c
|
||||
*
|
||||
* Created on: 11.08.2026
|
||||
* Author: Thorsten
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
#include "main.h"
|
||||
#include "openamp.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "stdio.h"
|
||||
#include "assert.h"
|
||||
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
#include "message_buffer.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
#include "IPC/ipc_eth_consumer.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
struct IPC_ETH_CONSUMER_Context
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
struct rpmsg_endpoint rp_endpoint;
|
||||
MessageBufferHandle_t mbufH;
|
||||
TaskHandle_t taskH;
|
||||
QueueHandle_t reqQH;
|
||||
int running;
|
||||
char endpoint[64];
|
||||
char payload[1520];
|
||||
char rxNetBuff[1520];
|
||||
uint32_t ipaddr;
|
||||
uint32_t bcast;
|
||||
uint32_t subnet;
|
||||
int ready;
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
#define IPC_PKT_HEADERLEN (20 )
|
||||
#define IPC_PKT_CONTROL_TYPE (0xDEADBEEF )
|
||||
#define IPC_PKT_ETHERNET_TYPE (0xDEADC0DE )
|
||||
#define IPC_PKT_DISCOVERY_TYPE (0xDEADDA7A )
|
||||
#define IPC_PKT_MAXSIZE (RPMSG_BUFFER_SIZE-32-IPC_PKT_HEADERLEN)
|
||||
|
||||
#define IPC_CTRL_TYPE_GETPENDING (0x80 )
|
||||
#define IPC_CTRL_TYPE_GETIPADDR (0xF0 )
|
||||
#define IPC_CTRL_TYPE_GETSUBNET (0xF1 )
|
||||
|
||||
#define IPC_CTRLREMOTE_SPINDLE_START (0xA0 )
|
||||
#define IPC_CTRLREMOTE_SPINDLE_STOP (0xA1 )
|
||||
#define IPC_CTRLREMOTE_STEP_RESET (0xA2 )
|
||||
#define IPC_CTRLREMOTE_STEP_REF (0xA3 )
|
||||
#define IPC_CTRLREMOTE_STEP_ON (0xA4 )
|
||||
#define IPC_CTRLREMOTE_STEP_OFF (0xA5 )
|
||||
#define IPC_CTRLREMOTE_STEP_MOVE (0xA6 )
|
||||
#define IPC_CTRLREMOTE_MAX_LENGTH (20 )
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
typedef struct ipc_eth_packet
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
unsigned int magic;
|
||||
unsigned int type;
|
||||
unsigned int length;
|
||||
unsigned int seqID;
|
||||
int result;
|
||||
char payload[IPC_PKT_MAXSIZE];
|
||||
} __attribute__((packed)) ipc_eth_packet_t;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
static ipc_eth_packet_t heartbeatPayload = {
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
.magic = IPC_PKT_DISCOVERY_TYPE,
|
||||
.type = 0,
|
||||
.length = 37,
|
||||
.result = 0,
|
||||
.seqID = 0,
|
||||
.payload = "Hello from STM32H755ZI-Q on ARM CM4!"
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
static int ipc_eth_ConsumerRpMsgRxClb(struct rpmsg_endpoint *ep, void *data, size_t len, uint32_t src, void *priv)
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
(void)ep;
|
||||
(void)src;
|
||||
|
||||
if(!priv)
|
||||
return -1;
|
||||
|
||||
IPC_ETH_CONSUMER_Handle_t h = (IPC_ETH_CONSUMER_Handle_t)priv;
|
||||
if(len < IPC_PKT_HEADERLEN)
|
||||
return 0;
|
||||
|
||||
if(!h->priv->ready)
|
||||
{
|
||||
ipc_eth_packet_t *req = (ipc_eth_packet_t *)data;
|
||||
req->result = -2;
|
||||
req->length = 0;
|
||||
OPENAMP_send(&h->priv->rp_endpoint, req, req->length + IPC_PKT_HEADERLEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ignore overflow cases, because we can not give errors back in that framework
|
||||
xMessageBufferSend(h->priv->mbufH, data, len, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
static int ipc_eth_ConsumerHandleControl(IPC_ETH_CONSUMER_Handle_t h, ipc_eth_packet_t *req)
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
if (!req)
|
||||
return -1;
|
||||
|
||||
req->length = 0;
|
||||
if(req->type != IPC_CTRL_TYPE_GETIPADDR && req->type != IPC_CTRL_TYPE_GETSUBNET && req->type != IPC_CTRL_TYPE_GETPENDING)
|
||||
return -1;
|
||||
|
||||
if( req->type != IPC_CTRL_TYPE_GETPENDING) {
|
||||
req->length = 4;
|
||||
uint32_t source = h->priv->ipaddr;
|
||||
if ( req->type == IPC_CTRL_TYPE_GETSUBNET )
|
||||
source = h->priv->subnet;
|
||||
|
||||
memcpy(req->payload, &source, sizeof(source));
|
||||
}
|
||||
else {
|
||||
int index = 0;
|
||||
req->result = 0;
|
||||
while( pdPASS == xQueueReceive(h->priv->reqQH, &req->payload[index * (IPC_CTRLREMOTE_MAX_LENGTH+IPC_PKT_HEADERLEN)], 0) ) {
|
||||
index += 1;
|
||||
if ( index > 8)
|
||||
break;
|
||||
req->length = index * (IPC_CTRLREMOTE_MAX_LENGTH+IPC_PKT_HEADERLEN);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
static void ipc_eth_ConsumerTaskFunction( void * arg )
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
IPC_ETH_CONSUMER_Handle_t h = (IPC_ETH_CONSUMER_Handle_t)arg;
|
||||
size_t bLen = 0;
|
||||
int rxLen = 0;
|
||||
BaseType_t ret;
|
||||
Socket_t xSocket = FREERTOS_INVALID_SOCKET;
|
||||
const TickType_t tmFlag = 0;
|
||||
struct freertos_sockaddr xDestinationAddress;
|
||||
struct freertos_sockaddr xLocalAddress;
|
||||
struct freertos_sockaddr xRecvAddress;
|
||||
socklen_t xRecvAddressLen;
|
||||
int status = 0;
|
||||
int rounds = 0;
|
||||
|
||||
uint32_t ulIPAddress;
|
||||
uint32_t ulBroadcast;
|
||||
uint32_t ulNetMask;
|
||||
NetworkInterface_t *pxInterface = NULL;
|
||||
NetworkEndPoint_t *pxEndPoint = NULL;;
|
||||
|
||||
if(!h)
|
||||
goto error;
|
||||
|
||||
if (!h->priv)
|
||||
goto error;
|
||||
|
||||
MAILBOX_Init();
|
||||
|
||||
if (MX_OPENAMP_Init(RPMSG_REMOTE, NULL))
|
||||
goto error;
|
||||
|
||||
status = OPENAMP_create_endpoint(&h->priv->rp_endpoint, h->priv->endpoint, RPMSG_ADDR_ANY,
|
||||
ipc_eth_ConsumerRpMsgRxClb, NULL);
|
||||
if (status < 0)
|
||||
goto error;
|
||||
|
||||
// set this instance as private data
|
||||
h->priv->rp_endpoint.priv = h;
|
||||
h->priv->ready = 0;
|
||||
|
||||
while(h->priv->running) {
|
||||
h->priv->ready = 0;
|
||||
rounds = 0;
|
||||
heartbeatPayload.seqID = 0;
|
||||
|
||||
// make sure, we always proceed only, when the stack is ready!
|
||||
while(xIPIsNetworkTaskReady() == pdFALSE) {
|
||||
vTaskDelay(pdMS_TO_TICKS(1));
|
||||
OPENAMP_check_for_message();
|
||||
if (h->priv->running == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
pxInterface = FreeRTOS_FirstNetworkInterface();
|
||||
if(pxInterface == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
// wait for PHY link detection
|
||||
if (pxInterface->pfGetPhyLinkStatus != NULL)
|
||||
{
|
||||
while(pxInterface->pfGetPhyLinkStatus(pxInterface) != pdTRUE ) {
|
||||
vTaskDelay(pdMS_TO_TICKS(1));
|
||||
OPENAMP_check_for_message();
|
||||
if (h->priv->running == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pxEndPoint = FreeRTOS_FirstEndPoint( pxInterface );
|
||||
while( pxEndPoint != NULL )
|
||||
{
|
||||
#if ( ipconfigUSE_IPv6 != 0 )
|
||||
if( pxEndPoint->bits.bIPv6 != pdFALSE ) {
|
||||
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint );
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if( pxEndPoint == NULL ) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
|
||||
if(xSocket == FREERTOS_INVALID_SOCKET) {
|
||||
h->priv->running = 0;
|
||||
}
|
||||
|
||||
if ( xSocket != FREERTOS_INVALID_SOCKET ) {
|
||||
// in free rtos stack we do not have to set the broadcast flag for a socket explicitly!
|
||||
//ret = FreeRTOS_setsockopt(xSocket, 0, SO_BROADCAST, &bFlag, sizeof(bFlag));
|
||||
//if(ret) {
|
||||
// FreeRTOS_closesocket(xSocket);
|
||||
// h->priv->running = 0;
|
||||
//}
|
||||
|
||||
// we set the reception timeout to zero here
|
||||
ret = FreeRTOS_setsockopt(xSocket, 0, FREERTOS_SO_RCVTIMEO, &tmFlag, sizeof(tmFlag));
|
||||
if(ret) {
|
||||
FreeRTOS_closesocket(xSocket);
|
||||
h->priv->running = 0;
|
||||
}
|
||||
|
||||
//why the hack the broadcast address is completely wrong in this network stack? we fix it now!
|
||||
pxEndPoint->ipv4_defaults.ulBroadcastAddress = ( pxEndPoint->ipv4_defaults.ulIPAddress & pxEndPoint->ipv4_defaults.ulNetMask )
|
||||
| ~pxEndPoint->ipv4_defaults.ulNetMask;
|
||||
pxEndPoint->ipv4_settings.ulBroadcastAddress = ( pxEndPoint->ipv4_settings.ulIPAddress & pxEndPoint->ipv4_settings.ulNetMask )
|
||||
| ~pxEndPoint->ipv4_settings.ulNetMask;
|
||||
|
||||
if (pxEndPoint->ipv4_settings.ulIPAddress == 0) {
|
||||
ulIPAddress = pxEndPoint->ipv4_defaults.ulIPAddress;
|
||||
ulNetMask = pxEndPoint->ipv4_defaults.ulNetMask;
|
||||
ulBroadcast = pxEndPoint->ipv4_defaults.ulBroadcastAddress;
|
||||
}
|
||||
else{
|
||||
ulIPAddress = pxEndPoint->ipv4_settings.ulIPAddress;
|
||||
ulNetMask = pxEndPoint->ipv4_settings.ulNetMask;
|
||||
ulBroadcast = pxEndPoint->ipv4_settings.ulBroadcastAddress;
|
||||
}
|
||||
|
||||
h->priv->ipaddr = ulIPAddress;
|
||||
h->priv->bcast = ulBroadcast;
|
||||
h->priv->subnet = ulNetMask;
|
||||
|
||||
|
||||
xDestinationAddress.sin_len = sizeof(xDestinationAddress);
|
||||
xDestinationAddress.sin_address.ulIP_IPv4 = ulBroadcast;
|
||||
xDestinationAddress.sin_port = FreeRTOS_htons( 10000 );
|
||||
xDestinationAddress.sin_family = FREERTOS_AF_INET4;
|
||||
|
||||
xLocalAddress.sin_len = sizeof(xLocalAddress);
|
||||
xLocalAddress.sin_address.ulIP_IPv4 = 0;
|
||||
xLocalAddress.sin_port = FreeRTOS_htons( 10000 );
|
||||
xLocalAddress.sin_family = FREERTOS_AF_INET4;
|
||||
|
||||
OPENAMP_check_for_message();
|
||||
ret = FreeRTOS_bind(xSocket, &xLocalAddress, sizeof(struct freertos_sockaddr));
|
||||
if(ret) {
|
||||
FreeRTOS_closesocket(xSocket);
|
||||
h->priv->running = 0;
|
||||
}
|
||||
}
|
||||
|
||||
while(h->priv->running) {
|
||||
rounds += 1;
|
||||
OPENAMP_check_for_message();
|
||||
h->priv->ready = 1;
|
||||
|
||||
// only accept valid packets with at least the full packet size, otherwise ignore them!
|
||||
if ( (bLen = xMessageBufferReceive(h->priv->mbufH, h->priv->payload, sizeof(h->priv->payload), pdMS_TO_TICKS(1))) >= IPC_PKT_HEADERLEN) {
|
||||
|
||||
// check header to decide whether the packet is for control purpose or desired for
|
||||
// Ethernet transmission
|
||||
ipc_eth_packet_t *req = (ipc_eth_packet_t *)h->priv->payload;
|
||||
|
||||
if (req->length <= (bLen - IPC_PKT_HEADERLEN))
|
||||
{
|
||||
switch (req->magic)
|
||||
{
|
||||
case IPC_PKT_CONTROL_TYPE:
|
||||
{
|
||||
req->result = -1;
|
||||
req->result = ipc_eth_ConsumerHandleControl(h, req);
|
||||
break;
|
||||
}
|
||||
case IPC_PKT_ETHERNET_TYPE:
|
||||
{
|
||||
req->result = FreeRTOS_sendto( xSocket, req->payload, req->length, 0,
|
||||
&xDestinationAddress, sizeof( xDestinationAddress ));
|
||||
req->length = 0;
|
||||
break;
|
||||
}
|
||||
case IPC_PKT_DISCOVERY_TYPE:
|
||||
{
|
||||
req->result = FreeRTOS_sendto( xSocket, req, req->length + IPC_PKT_HEADERLEN, 0,
|
||||
&xDestinationAddress, sizeof( xDestinationAddress ));
|
||||
req->length = 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
req->result = -1;
|
||||
req->length = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OPENAMP_check_for_message();
|
||||
OPENAMP_send(&h->priv->rp_endpoint, req, req->length + IPC_PKT_HEADERLEN);
|
||||
}
|
||||
}
|
||||
|
||||
if( rounds >= 1000 ) {
|
||||
|
||||
OPENAMP_check_for_message();
|
||||
if (FreeRTOS_sendto( xSocket, &heartbeatPayload, heartbeatPayload.length + IPC_PKT_HEADERLEN,
|
||||
0, &xDestinationAddress, sizeof( xDestinationAddress ) ) < 0 ) {
|
||||
break;
|
||||
}
|
||||
rounds = 0;
|
||||
}
|
||||
|
||||
if ((rxLen = FreeRTOS_recvfrom(xSocket, h->priv->rxNetBuff, sizeof(h->priv->rxNetBuff),
|
||||
0, &xRecvAddress, &xRecvAddressLen)) >= IPC_PKT_HEADERLEN) {
|
||||
|
||||
OPENAMP_check_for_message();
|
||||
ipc_eth_packet_t *req = (ipc_eth_packet_t *)h->priv->rxNetBuff;
|
||||
|
||||
if (req->magic == IPC_PKT_CONTROL_TYPE && req->type >= IPC_CTRLREMOTE_SPINDLE_START &&
|
||||
req->type <= IPC_CTRLREMOTE_STEP_MOVE && req->length <= IPC_CTRLREMOTE_MAX_LENGTH) {
|
||||
// ignore overruns in case we have some
|
||||
if( req->length <= (size_t)rxLen - IPC_PKT_HEADERLEN )
|
||||
xQueueSend(h->priv->reqQH, req, 0);
|
||||
}
|
||||
}
|
||||
else if(rxLen < 0 && rxLen != FREERTOS_EWOULDBLOCK) {
|
||||
// socket error, so jump out of loop
|
||||
break;
|
||||
}
|
||||
|
||||
// check PHY link detection
|
||||
if (pxInterface->pfGetPhyLinkStatus != NULL)
|
||||
{
|
||||
if(pxInterface->pfGetPhyLinkStatus(pxInterface) != pdTRUE ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h->priv->ready = 0;
|
||||
FreeRTOS_closesocket(xSocket);
|
||||
xSocket = FREERTOS_INVALID_SOCKET;
|
||||
}
|
||||
|
||||
error:
|
||||
if (xSocket != FREERTOS_INVALID_SOCKET) {
|
||||
FreeRTOS_closesocket(xSocket);
|
||||
}
|
||||
if (h) {
|
||||
if (h->priv) {
|
||||
if (h->priv->rp_endpoint.priv == h) {
|
||||
// no abstraction for destroying, so calling library function directly
|
||||
rpmsg_destroy_ept(&h->priv->rp_endpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OPENAMP_DeInit();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
IPC_ETH_CONSUMER_Handle_t IPC_ETH_CONSUMER_Init(const char *endpoint)
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
IPC_ETH_CONSUMER_Handle_t h = NULL;
|
||||
|
||||
if(!endpoint)
|
||||
goto error;
|
||||
|
||||
if(endpoint[0] == '\0')
|
||||
goto error;
|
||||
|
||||
if(!(h = (IPC_ETH_CONSUMER_Handle_t)calloc(1, sizeof(struct IPC_ETH_CONSUMER_Handle))))
|
||||
goto error;
|
||||
|
||||
h->priv = (IPC_ETH_CONSUMER_Context_t)calloc(1, sizeof(struct IPC_ETH_CONSUMER_Context));
|
||||
if(!h->priv)
|
||||
goto error;
|
||||
|
||||
if ((h->priv->mbufH = xMessageBufferCreate(4*IPC_PKT_MAXSIZE)) == NULL)
|
||||
goto error;
|
||||
|
||||
if ((h->priv->reqQH = xQueueCreate(6, IPC_PKT_HEADERLEN + IPC_CTRLREMOTE_MAX_LENGTH)) == NULL)
|
||||
goto error;
|
||||
|
||||
strncpy(h->priv->endpoint, endpoint,
|
||||
sizeof(h->priv->endpoint)-1 < strlen(endpoint) ?
|
||||
sizeof(h->priv->endpoint)-1 : strlen(endpoint));
|
||||
h->priv->endpoint[sizeof(h->priv->endpoint)-1] = '\0';
|
||||
h->priv->running = 1;
|
||||
if (pdPASS != xTaskCreate(ipc_eth_ConsumerTaskFunction, "ipc2eth", 4096, h, configMAX_PRIORITIES - 3, &h->priv->taskH))
|
||||
goto error;
|
||||
|
||||
return h;
|
||||
|
||||
error:
|
||||
if (h) {
|
||||
if(h->priv) {
|
||||
if(h->priv->taskH) {
|
||||
h->priv->running = 0;
|
||||
vTaskDelete(h->priv->taskH);
|
||||
}
|
||||
if(h->priv->mbufH) {
|
||||
vMessageBufferDelete(h->priv->mbufH);
|
||||
}
|
||||
if(h->priv->reqQH) {
|
||||
vQueueDelete(h->priv->reqQH);
|
||||
}
|
||||
free(h->priv);
|
||||
}
|
||||
free(h);
|
||||
}
|
||||
h = NULL;
|
||||
|
||||
return h;
|
||||
}
|
||||
@@ -0,0 +1,505 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.c
|
||||
* @brief : Main program body
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "string.h"
|
||||
#include "openamp.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "stdio.h"
|
||||
#include "assert.h"
|
||||
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
#include "FreeRTOS_DHCP.h"
|
||||
#include "FreeRTOS_Routing.h"
|
||||
|
||||
#include "IPC/ipc_eth_consumer.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
extern void initialise_stdlib_abstraction( void );
|
||||
|
||||
/* USER CODE END PTD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
#ifndef HSEM_ID_0
|
||||
#define HSEM_ID_0 (0U) /* HW semaphore 0*/
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint32_t w[3]; // STM32 UUID: 96 Bit
|
||||
} uuid96_t;
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
#if 0
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||
#pragma location=0x10040000
|
||||
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
|
||||
#pragma location=0x10040080
|
||||
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
|
||||
|
||||
#elif defined ( __CC_ARM ) /* MDK ARM Compiler */
|
||||
|
||||
__attribute__((at(0x10040000))) ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
|
||||
__attribute__((at(0x10040080))) ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
|
||||
|
||||
#elif defined ( __GNUC__ ) /* GNU Compiler */
|
||||
|
||||
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDescripSection"))); /* Ethernet Rx DMA Descriptors */
|
||||
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDescripSection"))); /* Ethernet Tx DMA Descriptors */
|
||||
#endif
|
||||
|
||||
ETH_TxPacketConfig TxConfig;
|
||||
|
||||
ETH_HandleTypeDef heth;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
#endif
|
||||
ETH_HandleTypeDef heth;
|
||||
|
||||
static UBaseType_t ulNextRand;
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_ETH_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
extern void initialise_stdlib_abstraction( void );
|
||||
|
||||
#define BKPSRAM_BASE 0x38800000UL
|
||||
|
||||
typedef struct {
|
||||
uint32_t magic;
|
||||
uint32_t uuid[3];
|
||||
} device_shared_t;
|
||||
|
||||
#define DEVICE_SHARED \
|
||||
((volatile device_shared_t *)BKPSRAM_BASE)
|
||||
|
||||
static inline void stm32_read_uuid(uuid96_t *u)
|
||||
{
|
||||
if(DEVICE_SHARED->magic != 0x48475531) {
|
||||
u->w[0] = 0xDEADC0DE;
|
||||
u->w[1] = 0xBADEAFFE;
|
||||
u->w[2] = 0xCAFEBABE;
|
||||
} else {
|
||||
u->w[0] = DEVICE_SHARED->uuid[0];
|
||||
u->w[1] = DEVICE_SHARED->uuid[1];
|
||||
u->w[2] = DEVICE_SHARED->uuid[2];
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t mix32(uint32_t x)
|
||||
{
|
||||
x ^= x >> 16;
|
||||
x *= 0x7feb352d;
|
||||
x ^= x >> 15;
|
||||
x *= 0x846ca68b;
|
||||
x ^= x >> 16;
|
||||
return x;
|
||||
}
|
||||
|
||||
static void uuid_to_mac(uint8_t mac[6], uint32_t ifidx)
|
||||
{
|
||||
uuid96_t u;
|
||||
stm32_read_uuid(&u);
|
||||
|
||||
uint32_t a = mix32(u.w[0] ^ u.w[2] ^ ifidx);
|
||||
uint32_t b = mix32(u.w[1] ^ (ifidx * 0x9e3779b9u));
|
||||
|
||||
mac[0] = (uint8_t)(a >> 24);
|
||||
mac[1] = (uint8_t)(a >> 16);
|
||||
mac[2] = (uint8_t)(a >> 8);
|
||||
mac[3] = (uint8_t)(a);
|
||||
mac[4] = (uint8_t)(b >> 8);
|
||||
mac[5] = (uint8_t)(b);
|
||||
|
||||
mac[0] &= 0xFE; // unicast
|
||||
mac[0] |= 0x02; // locally administered
|
||||
}
|
||||
|
||||
static uint32_t uuid_to_seed(uint32_t ifidx)
|
||||
{
|
||||
uuid96_t u;
|
||||
stm32_read_uuid(&u);
|
||||
|
||||
return mix32(u.w[0] ^ u.w[1] ^ u.w[2] ^ (ifidx * 0x9e3779b9u));
|
||||
}
|
||||
|
||||
static uint32_t uuid_to_ipv4_lla(uint32_t ifidx)
|
||||
{
|
||||
uuid96_t u;
|
||||
stm32_read_uuid(&u);
|
||||
|
||||
uint32_t h = mix32(u.w[0] ^ u.w[1] ^ u.w[2] ^ (ifidx * 0x9e3779b9u));
|
||||
|
||||
uint8_t x = 1 + ((h >> 8) % 254);
|
||||
uint8_t y = 1 + (h & 0xFF);
|
||||
|
||||
return (169u << 24) | (254u << 16) | ((uint32_t)x << 8) | y;
|
||||
}
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
taskDISABLE_INTERRUPTS();
|
||||
__asm volatile( "bkpt #0" );
|
||||
for (;;) {;}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
__asm volatile( "bkpt #0" );
|
||||
for (;;) {;}
|
||||
}
|
||||
|
||||
void vAssertCalled( const char * const pcFileName, unsigned long ulLine )
|
||||
{
|
||||
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
|
||||
|
||||
/* Parameters are not used. */
|
||||
( void ) ulLine;
|
||||
( void ) pcFileName;
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* You can step out of this function to debug the assertion by using
|
||||
the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
|
||||
value. */
|
||||
while( ulSetToNonZeroInDebuggerToContinue == 0 )
|
||||
{
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
int __stdout_put_char(int ch)
|
||||
{
|
||||
(void)ch;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __stdin_get_char(void)
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
{
|
||||
(void)pxEndPoint;
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( ( eNetworkEvent == eNetworkUp ) && ( xTasksAlreadyCreated == pdFALSE ) )
|
||||
{
|
||||
/* Do nothing. Just a stub. */
|
||||
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
}
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
static uint32_t ulMultiplier = 0;
|
||||
if( !ulMultiplier ) uuid_to_seed(0);
|
||||
const uint32_t ulIncrement = 1UL;
|
||||
|
||||
/* Utility function to generate a pseudo random number. */
|
||||
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand ) & 0x7fffUL );
|
||||
}
|
||||
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = ( uint32_t ) uxRand();
|
||||
|
||||
return pdTRUE;
|
||||
}
|
||||
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return ( uint32_t ) uxRand();
|
||||
}
|
||||
|
||||
void vApplicationPingReplyHook( ePingReplyStatus_t eStatus,
|
||||
uint16_t usIdentifier )
|
||||
{
|
||||
(void)eStatus;
|
||||
(void)usIdentifier;
|
||||
/* Provide a stub for this function. */
|
||||
}
|
||||
|
||||
|
||||
eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase,
|
||||
struct xNetworkEndPoint * pxEndPoint,
|
||||
IP_Address_t * pxIPAddress )
|
||||
{
|
||||
(void)eDHCPPhase;
|
||||
(void)pxEndPoint;
|
||||
(void)pxIPAddress;
|
||||
|
||||
/* Provide a stub for this function. */
|
||||
return eDHCPContinue;
|
||||
}
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* This function will be called during the DHCP: the machine will be registered
|
||||
* with an IP address plus this name. */
|
||||
return "STM32H755ZI-Q-Labor";
|
||||
}
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
static NetworkInterface_t xInterfaces[ 1 ];
|
||||
static NetworkEndPoint_t xEndPoints[ 1 ];
|
||||
|
||||
extern NetworkInterface_t * pxSTM32_FillInterfaceDescriptor( BaseType_t xEMACIndex,
|
||||
NetworkInterface_t * pxInterface );
|
||||
extern NetworkInterface_t * pxLoopback_FillInterfaceDescriptor( BaseType_t xEMACIndex,
|
||||
NetworkInterface_t * pxInterface );
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* USER CODE BEGIN Boot_Mode_Sequence_1 */
|
||||
/*HW semaphore Clock enable*/
|
||||
__HAL_RCC_HSEM_CLK_ENABLE();
|
||||
/* Activate HSEM notification for Cortex-M4*/
|
||||
HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
|
||||
/*
|
||||
Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to
|
||||
perform system initialization (system clock config, external memory configuration.. )
|
||||
*/
|
||||
HAL_PWREx_ClearPendingEvent();
|
||||
HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
|
||||
/* Clear HSEM flag */
|
||||
__HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
|
||||
|
||||
/* USER CODE END Boot_Mode_Sequence_1 */
|
||||
/* MCU Configuration--------------------------------------------------------*/
|
||||
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||
HAL_Init();
|
||||
|
||||
/* USER CODE BEGIN Init */
|
||||
|
||||
pxSTM32_FillInterfaceDescriptor(
|
||||
1,
|
||||
&( xInterfaces[ 0 ] )
|
||||
);
|
||||
|
||||
/* Attach an endpoint to that interface. */
|
||||
uint32_t ip4gen = uuid_to_ipv4_lla(0);
|
||||
const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ] = { ( ip4gen >> 24 ) & 0xFF,
|
||||
( ip4gen >> 16 ) & 0xFF, ( ip4gen >> 8 ) & 0xFF, ( ip4gen >> 0 ) & 0xFF };
|
||||
const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ] = { 255, 255, 0, 0 };
|
||||
const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ] = { 169, 254, 0, 1 };
|
||||
const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ] = { 1, 1, 1, 1 };
|
||||
uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] = { 0 };
|
||||
uuid_to_mac(ucMACAddress, 0);
|
||||
|
||||
/* Attach an endpoint to that interface. */
|
||||
FreeRTOS_FillEndPoint(
|
||||
&( xInterfaces[ 0 ] ),
|
||||
&( xEndPoints[ 0 ] ),
|
||||
ucIPAddress,
|
||||
ucNetMask,
|
||||
ucGatewayAddress,
|
||||
ucDNSServerAddress,
|
||||
ucMACAddress
|
||||
);
|
||||
|
||||
//switch off dhcp and directly use LLA address determined by the UUID
|
||||
xEndPoints[ 0 ].bits.bWantDHCP = 0;
|
||||
/* USER CODE END Init */
|
||||
|
||||
/* USER CODE BEGIN SysInit */
|
||||
|
||||
/* USER CODE END SysInit */
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_ETH_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
IPC_ETH_CONSUMER_Init("eth_endpoint");
|
||||
|
||||
initialise_stdlib_abstraction();
|
||||
|
||||
FreeRTOS_IPInit_Multi();
|
||||
|
||||
vTaskStartScheduler();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ETH Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_ETH_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN ETH_Init 0 */
|
||||
#if 0
|
||||
/* USER CODE END ETH_Init 0 */
|
||||
|
||||
static uint8_t MACAddr[6];
|
||||
|
||||
/* USER CODE BEGIN ETH_Init 1 */
|
||||
|
||||
/* USER CODE END ETH_Init 1 */
|
||||
heth.Instance = ETH;
|
||||
MACAddr[0] = 0x00;
|
||||
MACAddr[1] = 0x80;
|
||||
MACAddr[2] = 0xE1;
|
||||
MACAddr[3] = 0x00;
|
||||
MACAddr[4] = 0x00;
|
||||
MACAddr[5] = 0x00;
|
||||
heth.Init.MACAddr = &MACAddr[0];
|
||||
heth.Init.MediaInterface = HAL_ETH_RMII_MODE;
|
||||
heth.Init.TxDesc = DMATxDscrTab;
|
||||
heth.Init.RxDesc = DMARxDscrTab;
|
||||
heth.Init.RxBuffLen = 1536;
|
||||
|
||||
/* USER CODE BEGIN MACADDRESS */
|
||||
|
||||
/* USER CODE END MACADDRESS */
|
||||
|
||||
if (HAL_ETH_Init(&heth) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
memset(&TxConfig, 0 , sizeof(ETH_TxPacketConfig));
|
||||
TxConfig.Attributes = ETH_TX_PACKETS_FEATURES_CSUM | ETH_TX_PACKETS_FEATURES_CRCPAD;
|
||||
TxConfig.ChecksumCtrl = ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC;
|
||||
TxConfig.CRCPadCtrl = ETH_CRC_PAD_INSERT;
|
||||
/* USER CODE BEGIN ETH_Init 2 */
|
||||
#endif
|
||||
/* USER CODE END ETH_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_GPIO_Init(void)
|
||||
{
|
||||
/* USER CODE BEGIN MX_GPIO_Init_1 */
|
||||
/* USER CODE END MX_GPIO_Init_1 */
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
|
||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||
/* USER CODE END MX_GPIO_Init_2 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
||||
/**
|
||||
* @brief This function is executed in case of error occurrence.
|
||||
* @retval None
|
||||
*/
|
||||
void Error_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END Error_Handler_Debug */
|
||||
}
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief Reports the name of the source file and the source line number
|
||||
* where the assert_param error has occurred.
|
||||
* @param file: pointer to the source file name
|
||||
* @param line: assert_param error line source number
|
||||
* @retval None
|
||||
*/
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
/* USER CODE BEGIN 6 */
|
||||
/* User can add his own implementation to report the file name and line number,
|
||||
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
/* USER CODE END 6 */
|
||||
}
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
@@ -0,0 +1,869 @@
|
||||
/**
|
||||
* \file mvsyscall.c
|
||||
* \brief Wrappers required to use newlib malloc-family within FreeRTOS.
|
||||
* The syscalls for stdlib are implemented in a minimum way as well
|
||||
*
|
||||
* \par Overview
|
||||
* Route FreeRTOS memory management functions to newlib's malloc family.
|
||||
* Thus newlib and FreeRTOS share memory-management routines and memory pool,
|
||||
* and all newlib's internal memory-management requirements are supported.
|
||||
*
|
||||
* \author Dave Nadler
|
||||
* \author Thorsten Kimmel
|
||||
* \date 20-August-2019
|
||||
* \version 02-Dec-2021 implemented syscalls for stdlib
|
||||
* \version 27-Jun-2020 Correct "FreeRTOS.h" capitalization, commentary
|
||||
* \version 24-Jun-2020 commentary only
|
||||
* \version 11-Sep-2019 malloc accounting, comments, newlib version check
|
||||
*
|
||||
* \see http://www.nadler.com/embedded/newlibAndFreeRTOS.html
|
||||
* \see https://sourceware.org/newlib/libc.html#Reentrancy
|
||||
* \see https://sourceware.org/newlib/libc.html#malloc
|
||||
* \see https://sourceware.org/newlib/libc.html#index-_005f_005fenv_005flock
|
||||
* \see https://sourceware.org/newlib/libc.html#index-_005f_005fmalloc_005flock
|
||||
* \see https://sourceforge.net/p/freertos/feature-requests/72/
|
||||
* \see http://www.billgatliff.com/newlib.html
|
||||
* \see http://wiki.osdev.org/Porting_Newlib
|
||||
* \see http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.html
|
||||
*
|
||||
*
|
||||
* \copyright
|
||||
* (c) Dave Nadler 2017-2020, All Rights Reserved.
|
||||
* Web: http://www.nadler.com
|
||||
* email: drn@nadler.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Use or redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
*
|
||||
* - Use or redistributions of source code must retain ALL ORIGINAL COMMENTS, AND
|
||||
* ANY CHANGES MUST BE DOCUMENTED, INCLUDING:
|
||||
* - Reason for change (purpose)
|
||||
* - Functional change
|
||||
* - Date and author contact
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <newlib.h>
|
||||
#include <malloc.h>
|
||||
#include <FreeRTOS.h>
|
||||
|
||||
/*!
|
||||
* In case there is a FreeRTOS used for this application, we have to include
|
||||
* additional dependencies which are used in memory wrappers
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef INC_FREERTOS_H
|
||||
# include "task.h"
|
||||
# include "semphr.h"
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* conditional check to make sure this syscall abstraction and the memory
|
||||
* wrapper fits to the correct newlib / stdlib version
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#if (( __NEWLIB__ != 3) && ( __NEWLIB__ != 4 )) || ((__NEWLIB__ != 3) && (__NEWLIB_MINOR__ < 1)) || \
|
||||
((__NEWLIB__ == 3) && (__NEWLIB_MINOR__ > 3) )
|
||||
#warning "This wrapper was verified for newlib versions 3.1 - 3.3; please ensure newlib's external requirements for malloc-family are unchanged!"
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* conditional check to make sure the correct reentrancy configuration has been
|
||||
* set. Otherwise the stdlib calls could be lead to undefined behavior whenever
|
||||
* a function is called simultaneous by more than one thread
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef INC_FREERTOS_H
|
||||
# if !defined(configUSE_NEWLIB_REENTRANT) || (configUSE_NEWLIB_REENTRANT != 1)
|
||||
# error "#define configUSE_NEWLIB_REENTRANT 1 which is required for thread-safety of newlib sprintf, dtoa, strtok, etc..."
|
||||
# endif
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef INC_FREERTOS_H
|
||||
// ----------------------------------------------------------------------------
|
||||
// The following functions are used to lock IRQs to make sure the newlib functions
|
||||
// can be used in an IRQ as well, this is not working as expected and so we disable it
|
||||
// for our platform so far, therefore we have to make sure the user can not enter newlib
|
||||
// functions when running in ISR context
|
||||
//! Disables interrupts (after saving prior state)
|
||||
# define NEWLIB_FUNCS_INSIDE_ISR 0
|
||||
# if defined(NEWLIB_FUNCS_INSIDE_ISR) && NEWLIB_FUNCS_INSIDE_ISR != 0
|
||||
define DRN_ENTER_CRITICAL_SECTION(_usis) { _usis = taskENTER_CRITICAL_FROM_ISR(); }
|
||||
# else
|
||||
# define DRN_ENTER_CRITICAL_SECTION(_usis) do { int insideAnISR = xPortIsInsideInterrupt(); configASSERT( !insideAnISR ); } while(0)
|
||||
# endif
|
||||
|
||||
//! Re-enables interrupts (unless already disabled prior taskENTER_CRITICAL)
|
||||
# if defined(NEWLIB_FUNCS_INSIDE_ISR) && NEWLIB_FUNCS_INSIDE_ISR != 0
|
||||
# define DRN_EXIT_CRITICAL_SECTION(_usis) { taskEXIT_CRITICAL_FROM_ISR(_usis); }
|
||||
# else
|
||||
# define DRN_EXIT_CRITICAL_SECTION(_usis)
|
||||
# endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
# define __HeapBase _end
|
||||
# define __HeapLimit _estack
|
||||
|
||||
#define MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_STDOUT
|
||||
#define MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_MALLOC
|
||||
#define MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_ENV
|
||||
|
||||
/*!
|
||||
* The symbols __HeapBase and __HeapLimit are defined to read the
|
||||
* heap parameters from symbols defined in the linker script. The
|
||||
* define macros above are used to adapt these names to the name
|
||||
* of the variable in the linker script. Both variables will be used
|
||||
* later to allocate and manage memory of the heap and to detect a
|
||||
* stack / heap crash...
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
extern char __HeapBase, __HeapLimit;
|
||||
|
||||
int _write( int file, char* ptr, int len );
|
||||
int _read( int file, char* ptr, int len );
|
||||
|
||||
/*!
|
||||
* The following semaphore is used to prevent the stdout and stderr device
|
||||
* to be accessed simultaneous while writing data. This is necessary because
|
||||
* the stdlib itself is thread safe and has its own buffers for a thread but
|
||||
* the access to the hardware must be locked as well
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
static char memAlignmentAndSafetyBuffer[32] = {0};
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_STDOUT)
|
||||
static SemaphoreHandle_t stdioSemaphore;
|
||||
#endif
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_MALLOC)
|
||||
static SemaphoreHandle_t mallocSemaphore;
|
||||
#endif
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_ENV)
|
||||
static SemaphoreHandle_t envSemaphore;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* pointer to array of char* strings that define the current
|
||||
* environment variables of the applications environment
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#define xstr(a) str(a)
|
||||
#define str(a) #a
|
||||
#define NEWLIB_ENV "STDLIB=newlib-" xstr(__NEWLIB__) "." xstr(__NEWLIB_MINOR__)
|
||||
#ifdef NDEBUG
|
||||
# define DEBUG_ENV "DEBUG_ENV=RELEASE"
|
||||
#else
|
||||
# define DEBUG_ENV "DEBUG_ENV=DEBUG"
|
||||
#endif
|
||||
#define GNUC_ENV "GNUC=" xstr(__GNUC__) "." xstr(__GNUC_MINOR__)
|
||||
#define OS_VERSION_ENV "OSVERSION=" xstr(tskKERNEL_VERSION_MAJOR) "." xstr(tskKERNEL_VERSION_MINOR)
|
||||
static char* __env[] = { "ARCH=ARM32", "MCU=STM32F746ZI", "PLATFORM=ARM_FW_PLAYGROUND", "OS=FreeRTOS", "USERNAME=STM32",
|
||||
NEWLIB_ENV, OS_VERSION_ENV, GNUC_ENV, DEBUG_ENV, "BUILDTIME=" xstr(__TIME__), "BUILDDATE=" xstr(__DATE__),
|
||||
NULL
|
||||
};
|
||||
char** environ = &__env[0];
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* \brief is used to provide an overwritable stdout channel which can be used
|
||||
* for debugging purposes in the application
|
||||
* \param chr
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) void __stdout_put_char( int chr );
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* \brief is used to provide an overwritable stdin channel which can be used
|
||||
* for debugging purposes in the application
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) int __stdin_get_char( void )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* \brief is used to provide an overwritable clock tick function which is used
|
||||
* by the stdlib
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) unsigned long long __stdlib_get_system_clock_ticks( void )
|
||||
{
|
||||
#if defined(INC_FREERTOS_H)
|
||||
return (unsigned long long)xTaskGetTickCount();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* \brief semihosting initialization function which should be called when _start
|
||||
* is called. afterwards main would be called.
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
void initialise_monitor_handles( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
memAlignmentAndSafetyBuffer[0] = 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief this function will be called after initialization of the .bss, .text,
|
||||
* and .data segment of the application and while the stdlib begins to initialize
|
||||
* its requirements. This is done by calling the __libc_init_array in _start.S routine
|
||||
* before calling the main function. By tagging a function with the "constructor"
|
||||
* attribute, the compiler will add the function pointer to this initialization list.
|
||||
* \attention This is a GCC attribute. In case the application is compiled with another
|
||||
* compiler, this attribute must be ported as well!
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__((constructor))
|
||||
void initialise_stdlib_abstraction( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
initialise_monitor_handles();
|
||||
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_STDOUT)
|
||||
stdioSemaphore = xSemaphoreCreateRecursiveMutex();
|
||||
|
||||
if ( stdioSemaphore == 0 )
|
||||
{
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
#endif
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_MALLOC)
|
||||
mallocSemaphore = xSemaphoreCreateRecursiveMutex();
|
||||
|
||||
if ( mallocSemaphore == 0 )
|
||||
{
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
#endif
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_ENV)
|
||||
envSemaphore = xSemaphoreCreateRecursiveMutex();
|
||||
|
||||
if ( envSemaphore == 0 )
|
||||
{
|
||||
vAssertCalled( __FILE__, __LINE__ );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief returns the process ID (PID) of the calling process.
|
||||
* \attention we have no real OS and so we only return PID 1 because
|
||||
* this is the only running process. Everything is in "kernel space" or
|
||||
* "machine mode"
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _getpid( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief The command kill sends the specified signal to the specified
|
||||
* process.
|
||||
* \attention we have no real OS and so we cannot kill our only running
|
||||
* process with PID 1
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _kill( int pid, int sig )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )pid;
|
||||
( void )sig;
|
||||
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = EINVAL;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief The command exit is used to stop the process or application
|
||||
* \attention if the application has called exit, we do must not return
|
||||
* from this function anymore
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( noreturn ) )
|
||||
void _exit ( int status )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
_kill( status, -1 );
|
||||
while ( 1 ) {}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief attempts to read up to 'len' bytes from file descriptor 'file'
|
||||
* into the buffer starting at 'ptr'.
|
||||
* \note currently there is only support for stdin. If any other devices
|
||||
* have to be integrated as well, one should implement an abstraction layer
|
||||
* which delegates the calls directly to the required device or ressource.
|
||||
* An example can be seen in altera board support packages with the "dev" struct
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _read( int file, char* ptr, int len )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )file;
|
||||
|
||||
int DataIdx;
|
||||
int resLen = 0;
|
||||
|
||||
if ( file == STDIN_FILENO )
|
||||
{
|
||||
for ( DataIdx = 0; DataIdx < len; )
|
||||
{
|
||||
int result = __stdin_get_char();
|
||||
if ( result == EOF )
|
||||
{
|
||||
if ( resLen == 0 )
|
||||
{
|
||||
resLen = EOF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
*ptr++ = ( char )result;
|
||||
resLen++;
|
||||
DataIdx++;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = EBADF;
|
||||
}
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return resLen;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief attempts to write 'len' bytes from file descriptor 'file'
|
||||
* out of the buffer starting at 'ptr'.
|
||||
* \note currently there is only support for stdout and stderr. If any other devices
|
||||
* have to be integrated as well, one should implement an abstraction layer
|
||||
* which delegates the calls directly to the required device or ressource.
|
||||
* An example can be seen in altera board support packages with the "dev" struct
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _write( int file, char* ptr, int len )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )file;
|
||||
|
||||
int DataIdx, locked = 0;
|
||||
|
||||
if ( file == STDOUT_FILENO || file == STDERR_FILENO )
|
||||
{
|
||||
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_STDOUT)
|
||||
if ( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xSemaphoreTakeRecursive( stdioSemaphore, -1 );
|
||||
locked = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (file == STDERR_FILENO)
|
||||
{
|
||||
__stdout_put_char('\033');
|
||||
__stdout_put_char('[');
|
||||
__stdout_put_char('3');
|
||||
__stdout_put_char('1');
|
||||
__stdout_put_char('m');
|
||||
}
|
||||
for ( DataIdx = 0; DataIdx < len; DataIdx++ )
|
||||
{
|
||||
__stdout_put_char( ptr[DataIdx] );
|
||||
}
|
||||
if (file == STDERR_FILENO)
|
||||
{
|
||||
__stdout_put_char('\033');
|
||||
__stdout_put_char('[');
|
||||
__stdout_put_char('0');
|
||||
__stdout_put_char('m');
|
||||
}
|
||||
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_STDOUT)
|
||||
if ( locked )
|
||||
{
|
||||
xSemaphoreGiveRecursive( stdioSemaphore );
|
||||
}
|
||||
#endif
|
||||
|
||||
return len;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = EBADF;
|
||||
}
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief attempts to close a descriptor.
|
||||
* \note currently there is no support for this function. If any other devices
|
||||
* have to be integrated as well, one should implement an abstraction layer
|
||||
* which delegates the calls directly to the required device or ressource.
|
||||
* An example can be seen in altera board support packages with the "dev" struct
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _close( int file )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )file;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief These function returns information about a file, in the buffer
|
||||
* pointed to by stat
|
||||
* \note currently there is only support for stdin/out/err function. If any other devices
|
||||
* have to be integrated as well, one should implement an abstraction layer
|
||||
* which delegates the calls directly to the required device or ressource.
|
||||
* An example can be seen in altera board support packages with the "dev" struct
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _fstat( int file, struct stat* st )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
st->st_dev = file;
|
||||
st->st_size = 0;
|
||||
st->st_blocks = 0;
|
||||
|
||||
if ( file >= 1 && file <= 3 )
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
st->st_mode = S_IFREG;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief checks wether a descriptor 'file' is a TTY device or not
|
||||
* \note currently there is only support for stdin/out/err function. If any other devices
|
||||
* have to be integrated as well, one should implement an abstraction layer
|
||||
* which delegates the calls directly to the required device or ressource.
|
||||
* An example can be seen in altera board support packages with the "dev" struct
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
int _isatty( int file )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
// is stdin, stdout or stderror
|
||||
if ( file >= 0 && file <= 2 )
|
||||
{
|
||||
return file;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = ECHILD;
|
||||
}
|
||||
errno = ECHILD;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _unlink( char* name )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )name;
|
||||
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = ENOENT;
|
||||
}
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _times( struct tms* buf )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
buf->tms_utime = buf->tms_cutime = 0; // we have no user space!
|
||||
buf->tms_stime = buf->tms_cstime = __stdlib_get_system_clock_ticks( ); // everything runs in one process!
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _stat( char* file, struct stat* st )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )file;
|
||||
( void )st;
|
||||
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _link( char* old, char* new )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )old;
|
||||
( void )new;
|
||||
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = EMLINK;
|
||||
}
|
||||
errno = EMLINK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _fork( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = EAGAIN;
|
||||
}
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
int _execve( char* name, char** argv, char** env )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )env;
|
||||
( void )name;
|
||||
( void )argv;
|
||||
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = ENOMEM;
|
||||
}
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
// External routines required by newlib's malloc (sbrk/_sbrk, __malloc_lock/unlock)
|
||||
// ================================================================================================
|
||||
|
||||
#if !defined(INC_FREERTOS_H)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
caddr_t _sbrk( int incr )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
register char* stack_ptr asm( "sp" );
|
||||
|
||||
extern char end asm( "end" );
|
||||
static char* heap_end;
|
||||
char* prev_heap_end;
|
||||
|
||||
if ( heap_end == 0 )
|
||||
{
|
||||
heap_end = &end;
|
||||
}
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
if ( heap_end + incr > stack_ptr )
|
||||
{
|
||||
// write(1, "Heap and stack collision\n", 25);
|
||||
// abort();
|
||||
if ( _impure_ptr != 0 )
|
||||
{
|
||||
_impure_ptr->_errno = ENOMEM;
|
||||
}
|
||||
errno = ENOMEM;
|
||||
return ( caddr_t ) -1;
|
||||
}
|
||||
|
||||
heap_end += incr;
|
||||
|
||||
return ( caddr_t ) prev_heap_end;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static int heapBytesRemaining;
|
||||
static unsigned int stickyHeapBytesRemaining;
|
||||
uint32_t TotalHeapSize;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static UBaseType_t malLock_uxSavedInterruptStatus;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void* _sbrk_r( struct _reent* pReent, int incr )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )malLock_uxSavedInterruptStatus;
|
||||
( void )pReent;
|
||||
( void )incr;
|
||||
register char* stack_ptr asm( "sp" );
|
||||
|
||||
// make sure to calculate the correct heap size and bytes remaining at the first call!
|
||||
if( TotalHeapSize == 0 )
|
||||
{
|
||||
TotalHeapSize = heapBytesRemaining = stickyHeapBytesRemaining
|
||||
= ( int )( ( &__HeapLimit ) - ( &__HeapBase ) )
|
||||
#ifdef configISR_STACK_SIZE_WORDS
|
||||
- ( configISR_STACK_SIZE_WORDS * 4 )
|
||||
#endif
|
||||
;
|
||||
};
|
||||
static char* currentHeapEnd = &__HeapBase;
|
||||
char* limit = ( xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED ) ?
|
||||
stack_ptr : // Before scheduler is started, limit is stack pointer (risky!)
|
||||
&__HeapLimit
|
||||
#ifdef configISR_STACK_SIZE_WORDS
|
||||
- ( configISR_STACK_SIZE_WORDS * 4 )
|
||||
#endif
|
||||
; // Once running, OK to reuse all remaining RAM except ISR stack (MSP) stack
|
||||
DRN_ENTER_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
if ( currentHeapEnd + incr > limit )
|
||||
{
|
||||
// Ooops, no more memory available...
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||
{
|
||||
extern void vApplicationMallocFailedHook( void );
|
||||
DRN_EXIT_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
vApplicationMallocFailedHook();
|
||||
}
|
||||
#elif defined(configHARD_STOP_ON_MALLOC_FAILURE)
|
||||
// If you want to alert debugger or halt...
|
||||
// WARNING: brkpt instruction may prevent watchdog operation...
|
||||
while( 1 )
|
||||
{
|
||||
__asm( "bkpt #0" );
|
||||
}; // Stop in GUI as if at a breakpoint (if debugging, otherwise loop forever)
|
||||
#else
|
||||
// Default, if you prefer to believe your application will gracefully trap out-of-memory...
|
||||
pReent->_errno = ENOMEM; // newlib's thread-specific errno
|
||||
DRN_EXIT_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
#endif
|
||||
return ( char* ) -1; // the malloc-family routine that called sbrk will return 0
|
||||
}
|
||||
|
||||
char* previousHeapEnd = currentHeapEnd;
|
||||
currentHeapEnd += incr;
|
||||
heapBytesRemaining -= incr;
|
||||
|
||||
// implement the statistical feature to provide the minimum free heap size feature
|
||||
// of FreeRTOS statistics
|
||||
if ( stickyHeapBytesRemaining > xPortGetFreeHeapSize() )
|
||||
{
|
||||
stickyHeapBytesRemaining = xPortGetFreeHeapSize();
|
||||
}
|
||||
|
||||
DRN_EXIT_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
return ( char* ) previousHeapEnd;
|
||||
}
|
||||
|
||||
/*! \brief non-reentrant sbrk uses is actually reentrant by using current context
|
||||
* because the current _reent structure is pointed to by global _impure_ptr
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
void* sbrk( ptrdiff_t __incr )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
return _sbrk_r( _impure_ptr, __incr );
|
||||
}
|
||||
|
||||
//! _sbrk is a synonym for sbrk.
|
||||
// ----------------------------------------------------------------------------
|
||||
char* _sbrk( int incr )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
return sbrk( incr );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) void __malloc_lock( struct _reent* r )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )r;
|
||||
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_MALLOC)
|
||||
if ( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xSemaphoreTakeRecursive( mallocSemaphore, -1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
DRN_ENTER_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) void __malloc_unlock( struct _reent* r )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
( void )r;
|
||||
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_MALLOC)
|
||||
if ( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xSemaphoreGiveRecursive( mallocSemaphore );
|
||||
}
|
||||
#endif
|
||||
|
||||
DRN_EXIT_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) void __env_lock( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_ENV)
|
||||
if ( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xSemaphoreTakeRecursive( envSemaphore, -1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
DRN_ENTER_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
__attribute__( ( weak ) ) void __env_unlock( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
#if defined(INC_FREERTOS_H) && defined(MV_SYSCALL_USE_EXCLUSIVE_LOCK_FOR_ENV)
|
||||
if ( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xSemaphoreGiveRecursive( envSemaphore );
|
||||
}
|
||||
#endif
|
||||
|
||||
DRN_EXIT_CRITICAL_SECTION( malLock_uxSavedInterruptStatus );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void* pvPortMalloc( size_t xSize )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
void* p = malloc( xSize );
|
||||
return p;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void vPortFree( void* pv )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
free( pv );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
size_t xPortGetFreeHeapSize( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
static int lockGuard = 0;
|
||||
if ( lockGuard != 0 ) return stickyHeapBytesRemaining;
|
||||
lockGuard = 1;
|
||||
struct mallinfo mi = mallinfo();
|
||||
size_t result = mi.fordblks + heapBytesRemaining;
|
||||
lockGuard = 0;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
size_t xPortGetMinimumEverFreeHeapSize ( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
return stickyHeapBytesRemaining;
|
||||
}
|
||||
|
||||
//! No implementation needed, but stub provided in case application already calls vPortInitialiseBlocks
|
||||
// ----------------------------------------------------------------------------
|
||||
void vPortInitialiseBlocks( void )
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,207 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_hal_msp.c
|
||||
* @brief This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* External functions --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ExternalFunctions */
|
||||
|
||||
/* USER CODE END ExternalFunctions */
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN MspInit 0 */
|
||||
|
||||
/* USER CODE END MspInit 0 */
|
||||
|
||||
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||
|
||||
/* System interrupt init*/
|
||||
|
||||
/* Peripheral interrupt init */
|
||||
/* CM7_SEV_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(CM7_SEV_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CM7_SEV_IRQn);
|
||||
/* HSEM2_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(HSEM2_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(HSEM2_IRQn);
|
||||
|
||||
/* USER CODE BEGIN MspInit 1 */
|
||||
|
||||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ETH MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param heth: ETH handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(heth->Instance==ETH)
|
||||
{
|
||||
/* USER CODE BEGIN ETH_MspInit 0 */
|
||||
|
||||
/* USER CODE END ETH_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_ETH1MAC_CLK_ENABLE();
|
||||
__HAL_RCC_ETH1TX_CLK_ENABLE();
|
||||
__HAL_RCC_ETH1RX_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
/**ETH GPIO Configuration
|
||||
PC1 ------> ETH_MDC
|
||||
PA1 ------> ETH_REF_CLK
|
||||
PA2 ------> ETH_MDIO
|
||||
PA7 ------> ETH_CRS_DV
|
||||
PC4 ------> ETH_RXD0
|
||||
PC5 ------> ETH_RXD1
|
||||
PB13 ------> ETH_TXD1
|
||||
PG11 ------> ETH_TX_EN
|
||||
PG13 ------> ETH_TXD0
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||
|
||||
/* ETH interrupt Init */
|
||||
HAL_NVIC_SetPriority(ETH_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ETH_IRQn);
|
||||
/* USER CODE BEGIN ETH_MspInit 1 */
|
||||
|
||||
/* USER CODE END ETH_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ETH MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param heth: ETH handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
|
||||
{
|
||||
if(heth->Instance==ETH)
|
||||
{
|
||||
/* USER CODE BEGIN ETH_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ETH_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ETH1MAC_CLK_DISABLE();
|
||||
__HAL_RCC_ETH1TX_CLK_DISABLE();
|
||||
__HAL_RCC_ETH1RX_CLK_DISABLE();
|
||||
|
||||
/**ETH GPIO Configuration
|
||||
PC1 ------> ETH_MDC
|
||||
PA1 ------> ETH_REF_CLK
|
||||
PA2 ------> ETH_MDIO
|
||||
PA7 ------> ETH_CRS_DV
|
||||
PC4 ------> ETH_RXD0
|
||||
PC5 ------> ETH_RXD1
|
||||
PB13 ------> ETH_TXD1
|
||||
PG11 ------> ETH_TX_EN
|
||||
PG13 ------> ETH_TXD0
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11|GPIO_PIN_13);
|
||||
|
||||
/* ETH interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(ETH_IRQn);
|
||||
/* USER CODE BEGIN ETH_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ETH_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -0,0 +1,259 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "stm32h7xx_it.h"
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern ETH_HandleTypeDef heth;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory management fault.
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pre-fetch fault, memory access fault.
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Undefined instruction or illegal state.
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 0 */
|
||||
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug monitor.
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||
#endif
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||
}
|
||||
#if 0
|
||||
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 0 */
|
||||
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SysTick_IRQn 0 */
|
||||
#endif
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
extern void xPortSysTickHandler( void );
|
||||
/* USER CODE END SysTick_IRQn 0 */
|
||||
HAL_IncTick();
|
||||
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||
xPortSysTickHandler();
|
||||
}
|
||||
#if 0
|
||||
// mask out the ETH_IRQ_Handler completely because it is provided
|
||||
// by the free rtos tcp ip stack template in NetworkInterface.c
|
||||
/* USER CODE END SysTick_IRQn 1 */
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32H7xx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file (startup_stm32h7xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles Ethernet global interrupt.
|
||||
*/
|
||||
void ETH_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN ETH_IRQn 0 */
|
||||
|
||||
/* USER CODE END ETH_IRQn 0 */
|
||||
HAL_ETH_IRQHandler(&heth);
|
||||
/* USER CODE BEGIN ETH_IRQn 1 */
|
||||
|
||||
/* USER CODE END ETH_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles CM7 send event interrupt for CM4.
|
||||
*/
|
||||
void CM7_SEV_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN CM7_SEV_IRQn 0 */
|
||||
#endif
|
||||
void CM7_SEV_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE END CM7_SEV_IRQn 0 */
|
||||
/* USER CODE BEGIN CM7_SEV_IRQn 1 */
|
||||
|
||||
/* USER CODE END CM7_SEV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles HSEM2 global interrupt.
|
||||
*/
|
||||
void HSEM2_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HSEM2_IRQn 0 */
|
||||
|
||||
/* USER CODE END HSEM2_IRQn 0 */
|
||||
HAL_HSEM_IRQHandler();
|
||||
/* USER CODE BEGIN HSEM2_IRQn 1 */
|
||||
|
||||
/* USER CODE END HSEM2_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,768 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file startup_stm32h755xx.s
|
||||
* @author MCD Application Team
|
||||
* @brief STM32H755xx Devices vector table for GCC based 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()).
|
||||
* After Reset the Cortex-M processor is in Thread mode,
|
||||
* priority is Privileged, and the Stack is set to Main.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2019 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
|
||||
/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
|
||||
|
||||
/**
|
||||
* @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 sp, =_estack /* 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
|
||||
bx lr
|
||||
.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 minimal vector table for a Cortex M. 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
|
||||
|
||||
|
||||
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 WWDG_IRQHandler /* Window WatchDog Interrupt ( wwdg1_it, wwdg2_it) */
|
||||
.word PVD_AVD_IRQHandler /* PVD/AVD through EXTI Line detection */
|
||||
.word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
|
||||
.word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
|
||||
.word FLASH_IRQHandler /* FLASH */
|
||||
.word RCC_IRQHandler /* RCC */
|
||||
.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 DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
|
||||
.word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
|
||||
.word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
|
||||
.word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
|
||||
.word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
|
||||
.word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
|
||||
.word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
|
||||
.word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
|
||||
.word FDCAN1_IT0_IRQHandler /* FDCAN1 interrupt line 0 */
|
||||
.word FDCAN2_IT0_IRQHandler /* FDCAN2 interrupt line 0 */
|
||||
.word FDCAN1_IT1_IRQHandler /* FDCAN1 interrupt line 1 */
|
||||
.word FDCAN2_IT1_IRQHandler /* FDCAN2 interrupt line 1 */
|
||||
.word EXTI9_5_IRQHandler /* External Line[9:5]s */
|
||||
.word TIM1_BRK_IRQHandler /* TIM1 Break interrupt */
|
||||
.word TIM1_UP_IRQHandler /* TIM1 Update interrupt */
|
||||
.word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation interrupt */
|
||||
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
|
||||
.word TIM2_IRQHandler /* TIM2 */
|
||||
.word TIM3_IRQHandler /* TIM3 */
|
||||
.word TIM4_IRQHandler /* TIM4 */
|
||||
.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 SPI1_IRQHandler /* SPI1 */
|
||||
.word SPI2_IRQHandler /* SPI2 */
|
||||
.word USART1_IRQHandler /* USART1 */
|
||||
.word USART2_IRQHandler /* USART2 */
|
||||
.word USART3_IRQHandler /* USART3 */
|
||||
.word EXTI15_10_IRQHandler /* External Line[15:10]s */
|
||||
.word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
|
||||
.word 0 /* Reserved */
|
||||
.word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
|
||||
.word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
|
||||
.word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
|
||||
.word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
|
||||
.word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
|
||||
.word FMC_IRQHandler /* FMC */
|
||||
.word SDMMC1_IRQHandler /* SDMMC1 */
|
||||
.word TIM5_IRQHandler /* TIM5 */
|
||||
.word SPI3_IRQHandler /* SPI3 */
|
||||
.word UART4_IRQHandler /* UART4 */
|
||||
.word UART5_IRQHandler /* UART5 */
|
||||
.word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */
|
||||
.word TIM7_IRQHandler /* TIM7 */
|
||||
.word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
|
||||
.word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
|
||||
.word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
|
||||
.word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
|
||||
.word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
|
||||
.word ETH_IRQHandler /* Ethernet */
|
||||
.word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */
|
||||
.word FDCAN_CAL_IRQHandler /* FDCAN calibration unit interrupt */
|
||||
.word CM7_SEV_IRQHandler /* CM7 Send event interrupt for CM4 */
|
||||
.word CM4_SEV_IRQHandler /* CM4 Send event interrupt for CM7 */
|
||||
.word 0 /* Reserved */
|
||||
.word 0 /* Reserved */
|
||||
.word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
|
||||
.word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
|
||||
.word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
|
||||
.word USART6_IRQHandler /* USART6 */
|
||||
.word I2C3_EV_IRQHandler /* I2C3 event */
|
||||
.word I2C3_ER_IRQHandler /* I2C3 error */
|
||||
.word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */
|
||||
.word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */
|
||||
.word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */
|
||||
.word OTG_HS_IRQHandler /* USB OTG HS */
|
||||
.word DCMI_IRQHandler /* DCMI */
|
||||
.word CRYP_IRQHandler /* Crypto */
|
||||
.word HASH_RNG_IRQHandler /* Hash and Rng */
|
||||
.word FPU_IRQHandler /* FPU */
|
||||
.word UART7_IRQHandler /* UART7 */
|
||||
.word UART8_IRQHandler /* UART8 */
|
||||
.word SPI4_IRQHandler /* SPI4 */
|
||||
.word SPI5_IRQHandler /* SPI5 */
|
||||
.word SPI6_IRQHandler /* SPI6 */
|
||||
.word SAI1_IRQHandler /* SAI1 */
|
||||
.word LTDC_IRQHandler /* LTDC */
|
||||
.word LTDC_ER_IRQHandler /* LTDC error */
|
||||
.word DMA2D_IRQHandler /* DMA2D */
|
||||
.word SAI2_IRQHandler /* SAI2 */
|
||||
.word QUADSPI_IRQHandler /* QUADSPI */
|
||||
.word LPTIM1_IRQHandler /* LPTIM1 */
|
||||
.word CEC_IRQHandler /* HDMI_CEC */
|
||||
.word I2C4_EV_IRQHandler /* I2C4 Event */
|
||||
.word I2C4_ER_IRQHandler /* I2C4 Error */
|
||||
.word SPDIF_RX_IRQHandler /* SPDIF_RX */
|
||||
.word OTG_FS_EP1_OUT_IRQHandler /* USB OTG FS End Point 1 Out */
|
||||
.word OTG_FS_EP1_IN_IRQHandler /* USB OTG FS End Point 1 In */
|
||||
.word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI */
|
||||
.word OTG_FS_IRQHandler /* USB OTG FS */
|
||||
.word DMAMUX1_OVR_IRQHandler /* DMAMUX1 Overrun interrupt */
|
||||
.word HRTIM1_Master_IRQHandler /* HRTIM Master Timer global Interrupt */
|
||||
.word HRTIM1_TIMA_IRQHandler /* HRTIM Timer A global Interrupt */
|
||||
.word HRTIM1_TIMB_IRQHandler /* HRTIM Timer B global Interrupt */
|
||||
.word HRTIM1_TIMC_IRQHandler /* HRTIM Timer C global Interrupt */
|
||||
.word HRTIM1_TIMD_IRQHandler /* HRTIM Timer D global Interrupt */
|
||||
.word HRTIM1_TIME_IRQHandler /* HRTIM Timer E global Interrupt */
|
||||
.word HRTIM1_FLT_IRQHandler /* HRTIM Fault global Interrupt */
|
||||
.word DFSDM1_FLT0_IRQHandler /* DFSDM Filter0 Interrupt */
|
||||
.word DFSDM1_FLT1_IRQHandler /* DFSDM Filter1 Interrupt */
|
||||
.word DFSDM1_FLT2_IRQHandler /* DFSDM Filter2 Interrupt */
|
||||
.word DFSDM1_FLT3_IRQHandler /* DFSDM Filter3 Interrupt */
|
||||
.word SAI3_IRQHandler /* SAI3 global Interrupt */
|
||||
.word SWPMI1_IRQHandler /* Serial Wire Interface 1 global interrupt */
|
||||
.word TIM15_IRQHandler /* TIM15 global Interrupt */
|
||||
.word TIM16_IRQHandler /* TIM16 global Interrupt */
|
||||
.word TIM17_IRQHandler /* TIM17 global Interrupt */
|
||||
.word MDIOS_WKUP_IRQHandler /* MDIOS Wakeup Interrupt */
|
||||
.word MDIOS_IRQHandler /* MDIOS global Interrupt */
|
||||
.word JPEG_IRQHandler /* JPEG global Interrupt */
|
||||
.word MDMA_IRQHandler /* MDMA global Interrupt */
|
||||
.word 0 /* Reserved */
|
||||
.word SDMMC2_IRQHandler /* SDMMC2 global Interrupt */
|
||||
.word HSEM1_IRQHandler /* HSEM1 global Interrupt */
|
||||
.word HSEM2_IRQHandler /* HSEM1 global Interrupt */
|
||||
.word ADC3_IRQHandler /* ADC3 global Interrupt */
|
||||
.word DMAMUX2_OVR_IRQHandler /* DMAMUX Overrun interrupt */
|
||||
.word BDMA_Channel0_IRQHandler /* BDMA Channel 0 global Interrupt */
|
||||
.word BDMA_Channel1_IRQHandler /* BDMA Channel 1 global Interrupt */
|
||||
.word BDMA_Channel2_IRQHandler /* BDMA Channel 2 global Interrupt */
|
||||
.word BDMA_Channel3_IRQHandler /* BDMA Channel 3 global Interrupt */
|
||||
.word BDMA_Channel4_IRQHandler /* BDMA Channel 4 global Interrupt */
|
||||
.word BDMA_Channel5_IRQHandler /* BDMA Channel 5 global Interrupt */
|
||||
.word BDMA_Channel6_IRQHandler /* BDMA Channel 6 global Interrupt */
|
||||
.word BDMA_Channel7_IRQHandler /* BDMA Channel 7 global Interrupt */
|
||||
.word COMP1_IRQHandler /* COMP1 global Interrupt */
|
||||
.word LPTIM2_IRQHandler /* LP TIM2 global interrupt */
|
||||
.word LPTIM3_IRQHandler /* LP TIM3 global interrupt */
|
||||
.word LPTIM4_IRQHandler /* LP TIM4 global interrupt */
|
||||
.word LPTIM5_IRQHandler /* LP TIM5 global interrupt */
|
||||
.word LPUART1_IRQHandler /* LP UART1 interrupt */
|
||||
.word WWDG_RST_IRQHandler /* Window Watchdog reset interrupt (exti_d2_wwdg_it, exti_d1_wwdg_it) */
|
||||
.word CRS_IRQHandler /* Clock Recovery Global Interrupt */
|
||||
.word ECC_IRQHandler /* ECC diagnostic Global Interrupt */
|
||||
.word SAI4_IRQHandler /* SAI4 global interrupt */
|
||||
.word 0 /* Reserved */
|
||||
.word HOLD_CORE_IRQHandler /* Hold core interrupt */
|
||||
.word WAKEUP_PIN_IRQHandler /* Interrupt for all 6 wake-up pins */
|
||||
|
||||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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 WWDG_IRQHandler
|
||||
.thumb_set WWDG_IRQHandler,Default_Handler
|
||||
|
||||
.weak PVD_AVD_IRQHandler
|
||||
.thumb_set PVD_AVD_IRQHandler,Default_Handler
|
||||
|
||||
.weak TAMP_STAMP_IRQHandler
|
||||
.thumb_set TAMP_STAMP_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_WKUP_IRQHandler
|
||||
.thumb_set RTC_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak FLASH_IRQHandler
|
||||
.thumb_set FLASH_IRQHandler,Default_Handler
|
||||
|
||||
.weak RCC_IRQHandler
|
||||
.thumb_set RCC_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 DMA1_Stream0_IRQHandler
|
||||
.thumb_set DMA1_Stream0_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream1_IRQHandler
|
||||
.thumb_set DMA1_Stream1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream2_IRQHandler
|
||||
.thumb_set DMA1_Stream2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream3_IRQHandler
|
||||
.thumb_set DMA1_Stream3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream4_IRQHandler
|
||||
.thumb_set DMA1_Stream4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream5_IRQHandler
|
||||
.thumb_set DMA1_Stream5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream6_IRQHandler
|
||||
.thumb_set DMA1_Stream6_IRQHandler,Default_Handler
|
||||
|
||||
.weak ADC_IRQHandler
|
||||
.thumb_set ADC_IRQHandler,Default_Handler
|
||||
|
||||
.weak FDCAN1_IT0_IRQHandler
|
||||
.thumb_set FDCAN1_IT0_IRQHandler,Default_Handler
|
||||
|
||||
.weak FDCAN2_IT0_IRQHandler
|
||||
.thumb_set FDCAN2_IT0_IRQHandler,Default_Handler
|
||||
|
||||
.weak FDCAN1_IT1_IRQHandler
|
||||
.thumb_set FDCAN1_IT1_IRQHandler,Default_Handler
|
||||
|
||||
.weak FDCAN2_IT1_IRQHandler
|
||||
.thumb_set FDCAN2_IT1_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI9_5_IRQHandler
|
||||
.thumb_set EXTI9_5_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 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 SPI1_IRQHandler
|
||||
.thumb_set SPI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI2_IRQHandler
|
||||
.thumb_set SPI2_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 EXTI15_10_IRQHandler
|
||||
.thumb_set EXTI15_10_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_Alarm_IRQHandler
|
||||
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_BRK_TIM12_IRQHandler
|
||||
.thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_UP_TIM13_IRQHandler
|
||||
.thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_TRG_COM_TIM14_IRQHandler
|
||||
.thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM8_CC_IRQHandler
|
||||
.thumb_set TIM8_CC_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Stream7_IRQHandler
|
||||
.thumb_set DMA1_Stream7_IRQHandler,Default_Handler
|
||||
|
||||
.weak FMC_IRQHandler
|
||||
.thumb_set FMC_IRQHandler,Default_Handler
|
||||
|
||||
.weak SDMMC1_IRQHandler
|
||||
.thumb_set SDMMC1_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM5_IRQHandler
|
||||
.thumb_set TIM5_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI3_IRQHandler
|
||||
.thumb_set SPI3_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART4_IRQHandler
|
||||
.thumb_set UART4_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART5_IRQHandler
|
||||
.thumb_set UART5_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM6_DAC_IRQHandler
|
||||
.thumb_set TIM6_DAC_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM7_IRQHandler
|
||||
.thumb_set TIM7_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream0_IRQHandler
|
||||
.thumb_set DMA2_Stream0_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream1_IRQHandler
|
||||
.thumb_set DMA2_Stream1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream2_IRQHandler
|
||||
.thumb_set DMA2_Stream2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream3_IRQHandler
|
||||
.thumb_set DMA2_Stream3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream4_IRQHandler
|
||||
.thumb_set DMA2_Stream4_IRQHandler,Default_Handler
|
||||
|
||||
.weak ETH_IRQHandler
|
||||
.thumb_set ETH_IRQHandler,Default_Handler
|
||||
|
||||
.weak ETH_WKUP_IRQHandler
|
||||
.thumb_set ETH_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak FDCAN_CAL_IRQHandler
|
||||
.thumb_set FDCAN_CAL_IRQHandler,Default_Handler
|
||||
|
||||
.weak CM7_SEV_IRQHandler
|
||||
.thumb_set CM7_SEV_IRQHandler,Default_Handler
|
||||
|
||||
.weak CM4_SEV_IRQHandler
|
||||
.thumb_set CM4_SEV_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream5_IRQHandler
|
||||
.thumb_set DMA2_Stream5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream6_IRQHandler
|
||||
.thumb_set DMA2_Stream6_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Stream7_IRQHandler
|
||||
.thumb_set DMA2_Stream7_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART6_IRQHandler
|
||||
.thumb_set USART6_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 OTG_HS_EP1_OUT_IRQHandler
|
||||
.thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_EP1_IN_IRQHandler
|
||||
.thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_WKUP_IRQHandler
|
||||
.thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_HS_IRQHandler
|
||||
.thumb_set OTG_HS_IRQHandler,Default_Handler
|
||||
|
||||
.weak DCMI_IRQHandler
|
||||
.thumb_set DCMI_IRQHandler,Default_Handler
|
||||
|
||||
.weak CRYP_IRQHandler
|
||||
.thumb_set CRYP_IRQHandler,Default_Handler
|
||||
|
||||
.weak HASH_RNG_IRQHandler
|
||||
.thumb_set HASH_RNG_IRQHandler,Default_Handler
|
||||
|
||||
.weak FPU_IRQHandler
|
||||
.thumb_set FPU_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART7_IRQHandler
|
||||
.thumb_set UART7_IRQHandler,Default_Handler
|
||||
|
||||
.weak UART8_IRQHandler
|
||||
.thumb_set UART8_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 SAI1_IRQHandler
|
||||
.thumb_set SAI1_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 SAI2_IRQHandler
|
||||
.thumb_set SAI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak QUADSPI_IRQHandler
|
||||
.thumb_set QUADSPI_IRQHandler,Default_Handler
|
||||
|
||||
.weak LPTIM1_IRQHandler
|
||||
.thumb_set LPTIM1_IRQHandler,Default_Handler
|
||||
|
||||
.weak CEC_IRQHandler
|
||||
.thumb_set CEC_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C4_EV_IRQHandler
|
||||
.thumb_set I2C4_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C4_ER_IRQHandler
|
||||
.thumb_set I2C4_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPDIF_RX_IRQHandler
|
||||
.thumb_set SPDIF_RX_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_EP1_OUT_IRQHandler
|
||||
.thumb_set OTG_FS_EP1_OUT_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_EP1_IN_IRQHandler
|
||||
.thumb_set OTG_FS_EP1_IN_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_WKUP_IRQHandler
|
||||
.thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak OTG_FS_IRQHandler
|
||||
.thumb_set OTG_FS_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMAMUX1_OVR_IRQHandler
|
||||
.thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_Master_IRQHandler
|
||||
.thumb_set HRTIM1_Master_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_TIMA_IRQHandler
|
||||
.thumb_set HRTIM1_TIMA_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_TIMB_IRQHandler
|
||||
.thumb_set HRTIM1_TIMB_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_TIMC_IRQHandler
|
||||
.thumb_set HRTIM1_TIMC_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_TIMD_IRQHandler
|
||||
.thumb_set HRTIM1_TIMD_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_TIME_IRQHandler
|
||||
.thumb_set HRTIM1_TIME_IRQHandler,Default_Handler
|
||||
|
||||
.weak HRTIM1_FLT_IRQHandler
|
||||
.thumb_set HRTIM1_FLT_IRQHandler,Default_Handler
|
||||
|
||||
.weak DFSDM1_FLT0_IRQHandler
|
||||
.thumb_set DFSDM1_FLT0_IRQHandler,Default_Handler
|
||||
|
||||
.weak DFSDM1_FLT1_IRQHandler
|
||||
.thumb_set DFSDM1_FLT1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DFSDM1_FLT2_IRQHandler
|
||||
.thumb_set DFSDM1_FLT2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DFSDM1_FLT3_IRQHandler
|
||||
.thumb_set DFSDM1_FLT3_IRQHandler,Default_Handler
|
||||
|
||||
.weak SAI3_IRQHandler
|
||||
.thumb_set SAI3_IRQHandler,Default_Handler
|
||||
|
||||
.weak SWPMI1_IRQHandler
|
||||
.thumb_set SWPMI1_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 MDIOS_WKUP_IRQHandler
|
||||
.thumb_set MDIOS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak MDIOS_IRQHandler
|
||||
.thumb_set MDIOS_IRQHandler,Default_Handler
|
||||
|
||||
.weak JPEG_IRQHandler
|
||||
.thumb_set JPEG_IRQHandler,Default_Handler
|
||||
|
||||
.weak MDMA_IRQHandler
|
||||
.thumb_set MDMA_IRQHandler,Default_Handler
|
||||
|
||||
.weak SDMMC2_IRQHandler
|
||||
.thumb_set SDMMC2_IRQHandler,Default_Handler
|
||||
|
||||
.weak HSEM1_IRQHandler
|
||||
.thumb_set HSEM1_IRQHandler,Default_Handler
|
||||
|
||||
.weak HSEM2_IRQHandler
|
||||
.thumb_set HSEM2_IRQHandler,Default_Handler
|
||||
|
||||
.weak ADC3_IRQHandler
|
||||
.thumb_set ADC3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMAMUX2_OVR_IRQHandler
|
||||
.thumb_set DMAMUX2_OVR_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel0_IRQHandler
|
||||
.thumb_set BDMA_Channel0_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel1_IRQHandler
|
||||
.thumb_set BDMA_Channel1_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel2_IRQHandler
|
||||
.thumb_set BDMA_Channel2_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel3_IRQHandler
|
||||
.thumb_set BDMA_Channel3_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel4_IRQHandler
|
||||
.thumb_set BDMA_Channel4_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel5_IRQHandler
|
||||
.thumb_set BDMA_Channel5_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel6_IRQHandler
|
||||
.thumb_set BDMA_Channel6_IRQHandler,Default_Handler
|
||||
|
||||
.weak BDMA_Channel7_IRQHandler
|
||||
.thumb_set BDMA_Channel7_IRQHandler,Default_Handler
|
||||
|
||||
.weak COMP1_IRQHandler
|
||||
.thumb_set COMP1_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 LPUART1_IRQHandler
|
||||
.thumb_set LPUART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak WWDG_RST_IRQHandler
|
||||
.thumb_set WWDG_RST_IRQHandler,Default_Handler
|
||||
|
||||
.weak CRS_IRQHandler
|
||||
.thumb_set CRS_IRQHandler,Default_Handler
|
||||
|
||||
.weak ECC_IRQHandler
|
||||
.thumb_set ECC_IRQHandler,Default_Handler
|
||||
|
||||
.weak SAI4_IRQHandler
|
||||
.thumb_set SAI4_IRQHandler,Default_Handler
|
||||
|
||||
.weak HOLD_CORE_IRQHandler
|
||||
.thumb_set HOLD_CORE_IRQHandler,Default_Handler
|
||||
|
||||
.weak WAKEUP_PIN_IRQHandler
|
||||
.thumb_set WAKEUP_PIN_IRQHandler,Default_Handler
|
||||
|
||||
|
||||
Reference in new issue
Block a user