mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 00:37:44 -04:00
MPS2_AN385 improvements (#1225)
* MPS2_AN385 improvements Sync various MPS2_AN385 CORTEX-M3 QEMU targets and improve their Makefiles and cleanup gcc support: - FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2: - Makefile - output image size after linking - move -nostartfiles from compiler to linker flags - modernize compiler warning flags - add --gc-sections to linker flags - TCPEchoClient_SingleTasks.c: fix compiler warnings - main.c: fix compiler warnings (remove unused code) - main_networking.c - remove ipLOCAL_MAC_ADDRESS (unknown) - fix compiler warnings about unused params - startup.c: main(void), remove unused includes, silence unused params - syscalls.c: remove unused defines, silence unused params, more compact _sbrk() - FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc: - Makefile - CFLAGS/LDFLAGS in more readable lines - move -nostartfiles to linker flags - comment out -specs=rdimon.specs as it is not needed - startup_gcc.c: fix typo in comment, remove unused uart code - FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC - Makefile - after compilation output size of image - remove -DQEMU_SOC_MPS2, not needed - update many CFLAGS/LDFLAGS settings to more modern gcc/source - -ffunction-sections -fdata-sections is moved to CFLAGS - startup.c: sync with other ports - syscall.c: _write(): param buf is not unused, silence unused params Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com> * remove ipLOCAL_MAC_ADDRESS completely and fix formatting errors remove ipLOCAL_MAC_ADDRESS completely and fix formatting errors Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
This commit is contained in:
parent
49bbe71166
commit
995a030a92
12 changed files with 122 additions and 109 deletions
|
@ -1,4 +1,5 @@
|
|||
CC = arm-none-eabi-gcc
|
||||
SIZE = arm-none-eabi-size
|
||||
BIN := freertos_tcp_mps2_demo.axf
|
||||
|
||||
BUILD_DIR := build
|
||||
|
@ -51,30 +52,33 @@ SOURCE_FILES += ${FREERTOS_TCP}/source/portable/BufferManagement/BufferAllocatio
|
|||
SOURCE_FILES += ${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/NetworkInterface.c
|
||||
SOURCE_FILES += ${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.c
|
||||
|
||||
DEFINES := -DQEMU_SOC_MPS2 -DHEAP3
|
||||
|
||||
LDFLAGS = -T mps2_m3.ld -specs=nano.specs --specs=rdimon.specs -lc -lrdimon
|
||||
LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
|
||||
|
||||
CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-declaration
|
||||
CFLAGS += -Wno-builtin-declaration-mismatch -Werror
|
||||
DEFINES := -DHEAP3
|
||||
CPPFLAGS += $(DEFINES)
|
||||
|
||||
CFLAGS += -mthumb -mcpu=cortex-m3
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3 -Og
|
||||
CFLAGS += -g3 -Og -ffunction-sections -fdata-sections
|
||||
else
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -Os -ffunction-sections -fdata-sections
|
||||
endif
|
||||
CFLAGS += -fstrict-aliasing -Wstrict-aliasing -Wno-error=address-of-packed-member
|
||||
CFLAGS += -MMD
|
||||
CFLAGS += -Wall -Wextra -Wshadow
|
||||
#CFLAGS += -Wpedantic -fanalyzer
|
||||
#CFLAGS += -flto
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
|
||||
LDFLAGS = -T mps2_m3.ld
|
||||
LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
|
||||
LDFLAGS += -Xlinker --gc-sections
|
||||
LDFLAGS += -nostartfiles -specs=nano.specs -specs=nosys.specs -specs=rdimon.specs
|
||||
|
||||
OBJ_FILES := $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
|
||||
|
||||
CPPFLAGS += $(DEFINES)
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
$(BUILD_DIR)/$(BIN) : $(OBJ_FILES)
|
||||
$(CC) -ffunction-sections -fdata-sections $(CFLAGS) $(LDFLAGS) $+ -o $(@)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $+ -o $(@)
|
||||
$(SIZE) $(@)
|
||||
|
||||
%.d: %.c
|
||||
@set -e; rm -f $@; \
|
||||
|
@ -87,7 +91,7 @@ INCLUDES := $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.d)
|
|||
|
||||
${BUILD_DIR}/%.o : %.c Makefile
|
||||
-mkdir -p $(@D)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
-rm -rf build
|
||||
|
|
|
@ -206,10 +206,10 @@
|
|||
lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES );
|
||||
|
||||
/* Add in some unique text at the front of the string. */
|
||||
sprintf( pcTransmittedString, "TxRx message number %u", ulTxCount );
|
||||
sprintf( pcTransmittedString, "TxRx message number %lu", ulTxCount );
|
||||
ulTxCount++;
|
||||
|
||||
printf( "sending data to the echo server size %d original %d\n",
|
||||
printf( "sending data to the echo server size %ld original %d\n",
|
||||
lStringLength,
|
||||
echoBUFFER_SIZES );
|
||||
/* Send the string to the socket. */
|
||||
|
@ -217,7 +217,7 @@
|
|||
( void * ) pcTransmittedString, /* The data being sent. */
|
||||
lStringLength, /* The length of the data being sent. */
|
||||
0 ); /* No flags. */
|
||||
printf( "FreeRTOS_send returned...transmitted %d\n",
|
||||
printf( "FreeRTOS_send returned...transmitted %ld\n",
|
||||
lTransmitted );
|
||||
|
||||
if( lTransmitted < 0 )
|
||||
|
@ -398,15 +398,24 @@
|
|||
#if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
|
||||
eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase,
|
||||
uint32_t ulIPAddress )
|
||||
{
|
||||
( void ) eDHCPPhase;
|
||||
( void ) ulIPAddress;
|
||||
|
||||
return eDHCPContinue;
|
||||
}
|
||||
#else /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */
|
||||
eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase,
|
||||
struct xNetworkEndPoint * pxEndPoint,
|
||||
IP_Address_t * pxIPAddress )
|
||||
#endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */
|
||||
{
|
||||
/* Provide a stub for this function. */
|
||||
( void ) eDHCPPhase;
|
||||
( void ) pxEndPoint;
|
||||
( void ) pxIPAddress;
|
||||
|
||||
return eDHCPContinue;
|
||||
}
|
||||
#endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */
|
||||
|
||||
#endif /* if ( ipconfigUSE_DHCP_HOOK != 0 )*/
|
||||
|
||||
|
|
|
@ -40,9 +40,7 @@ void main_tcp_echo_client_tasks( void );
|
|||
void vApplicationIdleHook( void );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
extern void initialise_monitor_handles( void );
|
||||
|
||||
int main()
|
||||
int main( void )
|
||||
{
|
||||
main_tcp_echo_client_tasks();
|
||||
return 0;
|
||||
|
@ -84,8 +82,6 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
|||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
volatile size_t xFreeHeapSpace;
|
||||
|
||||
/* This is just a trivial example of an idle hook. It is called on each
|
||||
* cycle of the idle task. It must *NOT* attempt to block. In this case the
|
||||
* idle task just queries the amount of FreeRTOS heap that remains. See the
|
||||
|
|
|
@ -180,8 +180,6 @@ void main_tcp_echo_client_tasks( void )
|
|||
}
|
||||
#endif /* ( ipconfigUSE_DHCP != 0 ) */
|
||||
|
||||
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
|
||||
|
||||
FreeRTOS_IPInit_Multi();
|
||||
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
|
||||
|
@ -224,6 +222,10 @@ BaseType_t xTasksAlreadyCreated = pdFALSE;
|
|||
uint32_t ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
( void ) pxEndPoint;
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
|
@ -335,6 +337,10 @@ static void prvMiscInitialisation( void )
|
|||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
( void ) pxEndPoint;
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
|
|
|
@ -28,15 +28,14 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "CMSIS/CMSDK_CM3.h"
|
||||
#include "CMSIS/core_cm3.h"
|
||||
|
||||
extern void vPortSVCHandler( void );
|
||||
extern void xPortPendSVHandler( void );
|
||||
extern void xPortSysTickHandler( void );
|
||||
extern void uart_init();
|
||||
extern int main();
|
||||
extern void uart_init( void );
|
||||
extern int main( void );
|
||||
|
||||
void _start( void );
|
||||
void __attribute__( ( weak ) ) EthernetISR( void );
|
||||
|
||||
extern uint32_t _estack, _sidata, _sdata, _edata, _sbss, _ebss;
|
||||
|
@ -63,7 +62,6 @@ void Reset_Handler( void )
|
|||
}
|
||||
|
||||
/* jump to board initialisation */
|
||||
void _start( void );
|
||||
_start();
|
||||
}
|
||||
|
||||
|
@ -96,6 +94,16 @@ void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
|
|||
for( ; ; )
|
||||
{
|
||||
}
|
||||
|
||||
/* Remove the warning about unused variables. */
|
||||
( void ) r0;
|
||||
( void ) r1;
|
||||
( void ) r2;
|
||||
( void ) r3;
|
||||
( void ) r12;
|
||||
( void ) lr;
|
||||
( void ) pc;
|
||||
( void ) psr;
|
||||
}
|
||||
|
||||
static void Default_Handler( void ) __attribute__( ( naked ) );
|
||||
|
@ -114,7 +122,8 @@ void Default_Handler( void )
|
|||
"NVIC_INT_CTRL_CONST: .word 0xe000ed04\n"
|
||||
);
|
||||
}
|
||||
static void HardFault_Handler( void ) __attribute__( ( naked ) );
|
||||
|
||||
static void Default_Handler2( void ) __attribute__( ( naked ) );
|
||||
void Default_Handler2( void )
|
||||
{
|
||||
__asm volatile
|
||||
|
@ -158,7 +167,7 @@ void Default_Handler6( void )
|
|||
}
|
||||
}
|
||||
|
||||
const uint32_t * isr_vector[] __attribute__( ( section( ".isr_vector" ) ) ) =
|
||||
const uint32_t * const isr_vector[] __attribute__( ( section( ".isr_vector" ) ) ) =
|
||||
{
|
||||
( uint32_t * ) &_estack,
|
||||
( uint32_t * ) &Reset_Handler, /* Reset -15 */
|
||||
|
@ -195,7 +204,7 @@ const uint32_t * isr_vector[] __attribute__( ( section( ".isr_vector" ) ) ) =
|
|||
void _start( void )
|
||||
{
|
||||
uart_init();
|
||||
main( 0, 0 );
|
||||
main();
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
@ -212,4 +221,6 @@ __attribute__( ( naked ) ) void exit( int status )
|
|||
"bkpt 0xab\n"
|
||||
"end: b end\n"
|
||||
);
|
||||
|
||||
( void ) status;
|
||||
}
|
||||
|
|
|
@ -41,21 +41,18 @@ typedef struct UART_t
|
|||
#define UART0_ADDR ( ( UART_t * ) ( 0x40004000 ) )
|
||||
#define UART_DR( baseaddr ) ( *( unsigned int * ) ( baseaddr ) )
|
||||
|
||||
#define UART_STATE_TXFULL ( 1 << 0 )
|
||||
#define UART_CTRL_TX_EN ( 1 << 0 )
|
||||
#define UART_CTRL_RX_EN ( 1 << 1 )
|
||||
|
||||
|
||||
extern unsigned long _heap_bottom;
|
||||
extern unsigned long _heap_top;
|
||||
extern unsigned long g_ulBase;
|
||||
|
||||
static void * heap_end = 0;
|
||||
static char * heap_end = ( char * ) &_heap_bottom;
|
||||
|
||||
/**
|
||||
* @brief initializes the UART emulated hardware
|
||||
*/
|
||||
void uart_init()
|
||||
void uart_init( void )
|
||||
{
|
||||
UART0_ADDR->BAUDDIV = 16;
|
||||
UART0_ADDR->CTRL = UART_CTRL_TX_EN;
|
||||
|
@ -68,6 +65,7 @@ void uart_init()
|
|||
*/
|
||||
int _fstat( int file )
|
||||
{
|
||||
( void ) file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -80,6 +78,9 @@ int _read( int file,
|
|||
char * buf,
|
||||
int len )
|
||||
{
|
||||
( void ) file;
|
||||
( void ) buf;
|
||||
( void ) len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -97,6 +98,8 @@ int _write( int file,
|
|||
{
|
||||
int todo;
|
||||
|
||||
( void ) file;
|
||||
|
||||
for( todo = 0; todo < len; todo++ )
|
||||
{
|
||||
UART_DR( UART0_ADDR ) = *buf++;
|
||||
|
@ -113,16 +116,9 @@ int _write( int file,
|
|||
*/
|
||||
void * _sbrk( int incr )
|
||||
{
|
||||
char * prev_heap_end;
|
||||
void * prev_heap_end = heap_end;
|
||||
|
||||
if( heap_end == 0 )
|
||||
{
|
||||
heap_end = ( void * ) &_heap_bottom;
|
||||
}
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
|
||||
if( ( heap_end + incr ) > ( void * ) &_heap_top )
|
||||
if( ( heap_end + incr ) > ( char * ) &_heap_top )
|
||||
{
|
||||
return ( void * ) -1;
|
||||
}
|
||||
|
|
|
@ -9,13 +9,20 @@ LD = arm-none-eabi-gcc
|
|||
SIZE = arm-none-eabi-size
|
||||
MAKE = make
|
||||
|
||||
|
||||
CFLAGS += $(INCLUDE_DIRS) -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 \
|
||||
-Wall -Wextra -g3 -Os -ffunction-sections -fdata-sections \
|
||||
-MMD -MP -MF"$(@:%.o=%.d)" -MT $@
|
||||
|
||||
#CFLAGS += -Wpedantic -Wshadow -fanalyzer
|
||||
CFLAGS += -ffreestanding -mthumb -mcpu=cortex-m3
|
||||
CFLAGS += -Wall -Wextra -Wshadow
|
||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT $@
|
||||
#CFLAGS += -std=c99
|
||||
#CFLAGS += -Wpedantic -fanalyzer
|
||||
#CFLAGS += -flto
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
|
||||
LDFLAGS = -T ./mps2_m3.ld
|
||||
LDFLAGS += -Xlinker -Map=$(OUTPUT_DIR)/RTOSDemo.map
|
||||
LDFLAGS += -Xlinker --gc-sections
|
||||
LDFLAGS += -nostartfiles
|
||||
LDFLAGS += -specs=nano.specs -specs=nosys.specs # -specs=rdimon.specs
|
||||
|
||||
#
|
||||
# Kernel build.
|
||||
|
@ -106,9 +113,7 @@ $(IMAGE): ./mps2_m3.ld $(OBJS_OUTPUT) Makefile
|
|||
@echo ""
|
||||
@echo "--- Final linking ---"
|
||||
@echo ""
|
||||
$(LD) $(OBJS_OUTPUT) $(CFLAGS) -Xlinker --gc-sections -Xlinker -T ./mps2_m3.ld \
|
||||
-Xlinker -Map=$(OUTPUT_DIR)/RTOSDemo.map -specs=nano.specs \
|
||||
-specs=nosys.specs -specs=rdimon.specs -o $(IMAGE)
|
||||
$(LD) $(CFLAGS) $(LDFLAGS) $(OBJS_OUTPUT) -o $(IMAGE)
|
||||
$(SIZE) $(IMAGE)
|
||||
|
||||
$(DEP_OUTPUT):
|
||||
|
|
|
@ -27,22 +27,6 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* UART peripheral register addresses and bits. */
|
||||
#define UART0_ADDR ( ( UART_t * ) ( 0x40004000 ) )
|
||||
#define UART_DR( baseaddr ) ( *( uint32_t * ) ( baseaddr ) )
|
||||
#define UART_STATE( baseaddr ) ( *( uint32_t * ) ( baseaddr + 4 ) )
|
||||
#define UART_STATE_TXFULL ( 1 << 0 )
|
||||
|
||||
typedef struct UART_t
|
||||
{
|
||||
volatile uint32_t DATA;
|
||||
volatile uint32_t STATE;
|
||||
volatile uint32_t CTRL;
|
||||
volatile uint32_t INTSTATUS;
|
||||
volatile uint32_t BAUDDIV;
|
||||
} UART_t;
|
||||
|
||||
|
||||
/* FreeRTOS interrupt handlers. */
|
||||
extern void vPortSVCHandler( void );
|
||||
extern void xPortPendSVHandler( void );
|
||||
|
@ -99,7 +83,7 @@ void Reset_Handler( void )
|
|||
}
|
||||
|
||||
/* Variables used to store the value of registers at the time a hardfault
|
||||
* occurs. These are volatile to try and prevent the compiler/linker optimising
|
||||
* occurs. These are volatile to try and prevent the compiler/linker optimizing
|
||||
* them away as the variables never actually get used. */
|
||||
volatile uint32_t r0;
|
||||
volatile uint32_t r1;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
CC = arm-none-eabi-gcc
|
||||
SIZE = arm-none-eabi-size
|
||||
BIN := RTOSDemo.axf
|
||||
|
||||
BUILD_DIR := build
|
||||
|
@ -34,33 +35,23 @@ INCLUDE_DIRS += -I$(FREERTOS_DIR)/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/C
|
|||
INCLUDE_DIRS += -I$(KERNEL_DIR)/include
|
||||
INCLUDE_DIRS += -I$(KERNEL_DIR)/portable/GCC/ARM_CM3_MPU
|
||||
|
||||
DEFINES := -DQEMU_SOC_MPS2
|
||||
DEFINES := -DHEAP4
|
||||
|
||||
CPPFLAGS += $(DEFINES)
|
||||
|
||||
CFLAGS += -mcpu=cortex-m3
|
||||
CFLAGS += -Wno-error=implicit-function-declaration
|
||||
CFLAGS += -Wno-builtin-declaration-mismatch
|
||||
CFLAGS += -Werror
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -fstrict-aliasing
|
||||
CFLAGS += -Wstrict-aliasing
|
||||
CFLAGS += -Wno-error=address-of-packed-member
|
||||
CFLAGS += -Wno-unused-parameter
|
||||
CFLAGS += -mthumb -mcpu=cortex-m3
|
||||
CFLAGS += -Wall -Wextra -Wshadow -Wno-unused-parameter
|
||||
#CFLAGS += -Wpedantic -fanalyzer
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
|
||||
LDFLAGS = -T ./scripts/mps2_m3.ld
|
||||
LDFLAGS += -mthumb
|
||||
|
||||
LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
|
||||
LDFLAGS += -Xlinker --gc-sections
|
||||
LDFLAGS += -nostartfiles -nostdlib -nolibc -nodefaultlibs
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3 -Og -save-temps=obj
|
||||
CFLAGS += -g3 -Og -ffunction-sections -fdata-sections -save-temps=obj
|
||||
else
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -Os -ffunction-sections -fdata-sections
|
||||
endif
|
||||
|
||||
ifeq ($(PICOLIBC), 1)
|
||||
|
@ -73,7 +64,8 @@ OBJ_FILES := $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
|
|||
.PHONY: clean
|
||||
|
||||
$(BUILD_DIR)/$(BIN) : $(OBJ_FILES)
|
||||
$(CC) -ffunction-sections -fdata-sections $(LDFLAGS) $+ -o $(@)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $+ -o $(@)
|
||||
$(SIZE) $(@)
|
||||
|
||||
%.d: %.c
|
||||
@set -e; rm -f $@; \
|
||||
|
|
|
@ -35,7 +35,9 @@ extern void vPortSVCHandler( void );
|
|||
extern void xPortPendSVHandler( void );
|
||||
extern void xPortSysTickHandler( void );
|
||||
extern void uart_init( void );
|
||||
extern int main();
|
||||
extern int main( void );
|
||||
|
||||
void _start( void );
|
||||
|
||||
extern uint32_t _estack, _sidata, _sdata, _edata, _sbss, _ebss;
|
||||
|
||||
|
@ -61,13 +63,12 @@ void Reset_Handler( void )
|
|||
}
|
||||
|
||||
/* jump to board initialisation */
|
||||
void _start( void );
|
||||
_start();
|
||||
}
|
||||
|
||||
void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
|
||||
{
|
||||
/* These are volatile to try and prevent the compiler/linker optimising them
|
||||
/* These are volatile to try and prevent the compiler/linker optimizing them
|
||||
* away as the variables never actually get used. If the debugger won't show the
|
||||
* values of the variables, make them global my moving their declaration outside
|
||||
* of this function. */
|
||||
|
@ -122,6 +123,7 @@ void Default_Handler( void )
|
|||
"NVIC_INT_CTRL_CONST: .word 0xe000ed04\n"
|
||||
);
|
||||
}
|
||||
|
||||
static void HardFault_Handler( void ) __attribute__( ( naked ) );
|
||||
void HardFault_Handler( void )
|
||||
{
|
||||
|
@ -232,12 +234,12 @@ const uint32_t * const isr_vector[] __attribute__( ( section( ".isr_vector" ) )
|
|||
void _start( void )
|
||||
{
|
||||
uart_init();
|
||||
main( 0, 0 );
|
||||
main();
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
__attribute__( ( naked ) )
|
||||
void exit( __attribute__( ( unused ) ) int status )
|
||||
void exit( int status )
|
||||
{
|
||||
/* Force qemu to exit using ARM Semihosting */
|
||||
__asm volatile (
|
||||
|
@ -250,4 +252,6 @@ void exit( __attribute__( ( unused ) ) int status )
|
|||
"bkpt 0xab\n"
|
||||
"end: b end\n"
|
||||
);
|
||||
|
||||
( void ) status;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
void vApplicationIdleHook( void );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
int main()
|
||||
int main( void )
|
||||
{
|
||||
app_main();
|
||||
return 0;
|
||||
|
|
|
@ -69,7 +69,7 @@ void uart_init(void)
|
|||
int
|
||||
_uart_putc(char c, FILE *file)
|
||||
{
|
||||
(void) file;
|
||||
( void ) file;
|
||||
UART_DR( UART0_ADDR ) = c;
|
||||
return (unsigned char) c;
|
||||
}
|
||||
|
@ -90,8 +90,9 @@ static char * heap_end = ( char * ) &_heap_bottom;
|
|||
* @todo implement if necessary
|
||||
*
|
||||
*/
|
||||
int _fstat( __attribute__( ( unused ) ) int file )
|
||||
int _fstat( int file )
|
||||
{
|
||||
( void ) file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -100,10 +101,13 @@ int _fstat( __attribute__( ( unused ) ) int file )
|
|||
* @todo implement if necessary
|
||||
*
|
||||
*/
|
||||
int _read( __attribute__( ( unused ) ) int file,
|
||||
__attribute__( ( unused ) ) char * buf,
|
||||
__attribute__( ( unused ) ) int len )
|
||||
int _read( int file,
|
||||
char * buf,
|
||||
int len )
|
||||
{
|
||||
( void ) file;
|
||||
( void ) buf;
|
||||
( void ) len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -115,12 +119,14 @@ int _read( __attribute__( ( unused ) ) int file,
|
|||
* @param [in] len length of the buffer
|
||||
* @returns the number of bytes written
|
||||
*/
|
||||
int _write( __attribute__( ( unused ) ) int file,
|
||||
__attribute__( ( unused ) ) char * buf,
|
||||
int _write( int file,
|
||||
char * buf,
|
||||
int len )
|
||||
{
|
||||
int todo;
|
||||
|
||||
( void ) file;
|
||||
|
||||
for( todo = 0; todo < len; todo++ )
|
||||
{
|
||||
UART_DR( UART0_ADDR ) = *buf++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue