Fix formatting errors

pull/936/head
Rahul Kar 12 months ago
parent 92a502b03f
commit cf1b977eee

@ -31,7 +31,8 @@
#include <stdarg.h>
#include <stdio.h>
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
char * pcTaskName );
void vApplicationMallocFailedHook( void );
void vMainMQTTClientTasks( void );
void vApplicationIdleHook( void );
@ -55,10 +56,12 @@ int main ()
vTaskStartScheduler();
// The code should never reach here.
/* The code should never reach here. */
configASSERT( 0 );
for ( ;; ) {}
for( ; ; )
{
}
return 0;
}
@ -68,25 +71,32 @@ int main ()
void vApplicationMallocFailedHook( void )
{
/* Called if a call to pvPortMalloc() fails because there is insufficient
free memory available in the FreeRTOS heap. pvPortMalloc() is called
internally by FreeRTOS API functions that create tasks, queues, software
timers, and semaphores. The size of the FreeRTOS heap is set by the
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
* free memory available in the FreeRTOS heap. pvPortMalloc() is called
* internally by FreeRTOS API functions that create tasks, queues, software
* timers, and semaphores. The size of the FreeRTOS heap is set by the
* configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
taskDISABLE_INTERRUPTS();
for( ;; ){};
for( ; ; )
{
}
}
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
char * pcTaskName )
{
( void ) pcTaskName;
( void ) pxTask;
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
* configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
* function is called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
for( ;; ){};
for( ; ; )
{
}
}
/*-----------------------------------------------------------*/
@ -95,12 +105,12 @@ 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
memory management section on the https://www.FreeRTOS.org web site for memory
management options. If there is a lot of heap memory free then the
configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
RAM. */
* 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
* memory management section on the https://www.FreeRTOS.org web site for memory
* management options. If there is a lot of heap memory free then the
* configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
* RAM. */
}
/*-----------------------------------------------------------*/
@ -112,10 +122,11 @@ void vApplicationTickHook( void )
void vAssertCalled( void )
{
volatile unsigned long looping = 0;
taskENTER_CRITICAL();
{
/* Use the debugger to set looping to a non-zero value in order to step out
of this function to determine why it was called. */
/* Use the debugger to set looping to a non-zero value in order to step
* out of this function to determine why it was called. */
while( looping == 0LU )
{
portNOP();
@ -124,7 +135,8 @@ void vAssertCalled( void )
taskEXIT_CRITICAL();
}
/*-----------------------------------------------------------*/
void vLoggingPrintf( const char *pcFormat, ... )
void vLoggingPrintf( const char * pcFormat,
... )
{
va_list arg;

@ -185,7 +185,6 @@ void vPlatformInitIpStack( void )
{
BaseType_t xResult;
uint8_t ucIPAddress[ 4 ];
uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
uint8_t ucNullAddress[ 4 ] = { 0, 0, 0, 0 };
uint8_t ucMACAddress[ 6 ];
uint8_t ucDNSServerAddress[ 4 ];

@ -46,21 +46,23 @@ __attribute__((optimize("O0")))
__attribute__( ( naked ) )
void Reset_Handler( void )
{
// set stack pointer
/* set stack pointer */
__asm volatile ( "ldr r0, =_estack" );
__asm volatile ( "mov sp, r0" );
// copy .data section from flash to RAM
/* copy .data section from flash to RAM */
for( uint32_t * src = &_sidata, * dest = &_sdata; dest < &_edata; )
{
*dest++ = *src++;
}
// zero out .bss section
/* zero out .bss section */
for( uint32_t * dest = &_sbss; dest < &_ebss; )
{
*dest++ = 0;
}
// jump to board initialisation
/* jump to board initialisation */
void _start( void );
_start();
}
@ -68,9 +70,9 @@ void Reset_Handler(void)
void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
{
/* These are volatile to try and prevent the compiler/linker optimising 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. */
* 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. */
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
@ -91,7 +93,9 @@ of this function. */
psr = pulFaultStackAddress[ 7 ];
/* When the following line is hit, the variables contain the register values. */
for( ;; );
for( ; ; )
{
}
}
static void Default_Handler( void ) __attribute__( ( naked ) );
@ -113,7 +117,6 @@ void Default_Handler(void)
static void HardFault_Handler( void ) __attribute__( ( naked ) );
void Default_Handler2( void )
{
__asm volatile
(
" tst lr, #4 \n"
@ -129,56 +132,64 @@ void Default_Handler2(void)
void Default_Handler3( void )
{
for (;;) { }
for( ; ; )
{
}
}
void Default_Handler4( void )
{
for (;;) { }
for( ; ; )
{
}
}
void Default_Handler5( void )
{
for (;;) { }
for( ; ; )
{
}
}
void Default_Handler6( void )
{
for (;;) { }
for( ; ; )
{
}
}
const uint32_t * isr_vector[] __attribute__( ( section( ".isr_vector" ) ) ) =
{
( uint32_t * ) &_estack,
(uint32_t*)&Reset_Handler, // Reset -15
(uint32_t*)&Default_Handler, // NMI_Handler -14
(uint32_t*)&Default_Handler2, // HardFault_Handler -13
(uint32_t*)&Default_Handler3, // MemManage_Handler -12
(uint32_t*)&Default_Handler4, // BusFault_Handler -11
(uint32_t*)&Default_Handler5, // UsageFault_Handler -10
0, // reserved
0, // reserved
0, // reserved
0, // reserved -6
(uint32_t*)&vPortSVCHandler, // SVC_Handler -5
(uint32_t*)&Default_Handler6, // DebugMon_Handler -4
0, // reserved
(uint32_t*)&xPortPendSVHandler, // PendSV handler -2
(uint32_t*)&xPortSysTickHandler, // SysTick_Handler -1
0, // uart0 receive 0
0, // uart0 transmit
0, // uart1 receive
0, // uart1 transmit
0, // uart 2 receive
0, // uart 2 transmit
0, // GPIO 0 combined interrupt
0, // GPIO 2 combined interrupt
0, // Timer 0
0, // Timer 1
0, // Dial Timer
0, // SPI0 SPI1
0, // uart overflow 1 2,3 12
(uint32_t*)&EthernetISR, // Ethernet 13
( uint32_t * ) &Reset_Handler, /* Reset -15 */
( uint32_t * ) &Default_Handler, /* NMI_Handler -14 */
( uint32_t * ) &Default_Handler2, /* HardFault_Handler -13 */
( uint32_t * ) &Default_Handler3, /* MemManage_Handler -12 */
( uint32_t * ) &Default_Handler4, /* BusFault_Handler -11 */
( uint32_t * ) &Default_Handler5, /* UsageFault_Handler -10 */
0, /* reserved */
0, /* reserved */
0, /* reserved */
0, /* reserved -6 */
( uint32_t * ) &vPortSVCHandler, /* SVC_Handler -5 */
( uint32_t * ) &Default_Handler6, /* DebugMon_Handler -4 */
0, /* reserved */
( uint32_t * ) &xPortPendSVHandler, /* PendSV handler -2 */
( uint32_t * ) &xPortSysTickHandler, /* SysTick_Handler -1 */
0, /* uart0 receive 0 */
0, /* uart0 transmit */
0, /* uart1 receive */
0, /* uart1 transmit */
0, /* uart 2 receive */
0, /* uart 2 transmit */
0, /* GPIO 0 combined interrupt */
0, /* GPIO 2 combined interrupt */
0, /* Timer 0 */
0, /* Timer 1 */
0, /* Dial Timer */
0, /* SPI0 SPI1 */
0, /* uart overflow 1 2,3 12 */
( uint32_t * ) &EthernetISR, /* Ethernet 13 */
};
void _start( void )
@ -190,16 +201,15 @@ void _start(void)
__attribute__( ( naked ) ) void exit( int status )
{
// Force qemu to exit using ARM Semihosting
/* Force qemu to exit using ARM Semihosting */
__asm volatile (
"mov r1, r0\n"
"cmp r1, #0\n"
"bne .notclean\n"
"ldr r1, =0x20026\n" // ADP_Stopped_ApplicationExit, a clean exit
"ldr r1, =0x20026\n" /* ADP_Stopped_ApplicationExit, a clean exit */
".notclean:\n"
"movs r0, #0x18\n" // SYS_EXIT
"movs r0, #0x18\n" /* SYS_EXIT */
"bkpt 0xab\n"
"end: b end\n"
);
}

@ -29,7 +29,8 @@ extern "C" {
#include <sys/types.h>
typedef struct UART_t {
typedef struct UART_t
{
volatile uint32_t DATA;
volatile uint32_t STATE;
volatile uint32_t CTRL;
@ -75,7 +76,9 @@ int _fstat(int file)
* @todo implement if necessary
*
*/
int _read(int file, char *buf, int len)
int _read( int file,
char * buf,
int len )
{
return -1;
}
@ -88,13 +91,17 @@ int _read(int file, char *buf, int len)
* @param [in] len length of the buffer
* @returns the number of bytes written
*/
int _write(int file, char *buf, int len)
int _write( int file,
char * buf,
int len )
{
int todo;
for (todo = 0; todo < len; todo++){
for( todo = 0; todo < len; todo++ )
{
UART_DR( UART0_ADDR ) = *buf++;
}
return len;
}

Loading…
Cancel
Save