| Nano103 BSP V3.01.002 The Board Support Package for Nano103 Series

Data Structures | Macros | Enumerations | Functions | Variables
retarget.c File Reference

Nano 103 retarget source file. More...

`#include <stdio.h>`
`#include "Nano103.h"`

Go to the source code of this file.

## Data Structures
struct | __FILE

## Macros
#define | DEBUG_PORT UART0

## Enumerations
enum | { r0, r1, r2, r3, r12, lr, pc, psr }

## Functions
void | stackDump (uint32_t stack[])
void | Hard_Fault_Handler (uint32_t stack[])
__asm int32_t | HardFault_Handler (void)
| This HardFault handler is implemented to show r0, r1, r2, r3, r12, lr, pc, psr. More...
void | SendChar_ToUART (int ch)
| Write a char to UART. More...
void | SendChar (int ch)
| Write a char to debug console. More...
char | GetChar (void)
| Read a char from debug console. More...
int | kbhit (void)
| Check whether UART receive FIFO is empty or not. More...
int | IsDebugFifoEmpty (void)
| Check whether UART transmit FIFO is empty or not. More...
void | _ttywrch (int ch)
int | fputc (int ch, FILE *f)
int | fgetc (FILE *f)
int | ferror (FILE *f)

## Variables
FILE | __stdout
FILE | __stdin

## Detailed Description

Nano 103 retarget source file.

Version
  V1.00

Revision
  5

Date
  16/01/12 5:04p

Note
  SPDX-License-Identifier: Apache-2.0 Copyright (C) 2015 Nuvoton Technology Corp. All rights reserved.

Definition in file retarget.c.

## Macro Definition Documentation

## ◆ DEBUG_PORT

#define DEBUG_PORT UART0

Select Debug Port which is used for retarget.c to output debug message to UART

Definition at line 24 of file retarget.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
r0 |
r1 |
r2 |
r3 |
r12 |
lr |
pc |
psr |

Definition at line 49 of file retarget.c.

## Function Documentation

## ◆ _ttywrch()

void _ttywrch | ( | int | ch | ) |

Definition at line 483 of file retarget.c.

## ◆ ferror()

int ferror | ( | FILE * | f | ) |

Definition at line 533 of file retarget.c.

## ◆ fgetc()

int fgetc | ( | FILE * | f | ) |

Definition at line 527 of file retarget.c.

## ◆ fputc()

int fputc | ( | int | ch,
|  | FILE * | f
| ) |  |

Definition at line 489 of file retarget.c.

## ◆ GetChar()

char GetChar | ( | void |  | ) |

Read a char from debug console.

Parameters

  None |

Returns
  Received character from debug console

Note
  This API waits until UART debug port or semihost input a character

Definition at line 410 of file retarget.c.

## ◆ Hard_Fault_Handler()

void Hard_Fault_Handler | ( | uint32_t | stack[] | ) |

Definition at line 63 of file retarget.c.

## ◆ HardFault_Handler()

__asm int32_t HardFault_Handler | ( | void |  | ) |

This HardFault handler is implemented to show r0, r1, r2, r3, r12, lr, pc, psr.

Parameters

  None |

Returns
  None

This function is implement to print r0, r1, r2, r3, r12, lr, pc, psr

Definition at line 326 of file retarget.c.

## ◆ IsDebugFifoEmpty()

int IsDebugFifoEmpty | ( | void |  | ) |

Check whether UART transmit FIFO is empty or not.

Parameters

  None |

Returns
  UART Tx FIFO empty status

Return values

  1 | UART Tx FIFO is empty
  0 | UART Tx FIFO is not empty

Definition at line 470 of file retarget.c.

## ◆ kbhit()

int kbhit | ( | void |  | ) |

Check whether UART receive FIFO is empty or not.

Parameters

  None |

Returns
  UART Rx FIFO empty status

Return values

  1 | Indicates at least one character is available in UART Rx FIFO
  0 | UART Rx FIFO is empty

Definition at line 454 of file retarget.c.

## ◆ SendChar()

void SendChar | ( | int | ch | ) |

Write a char to debug console.

Parameters

  ch | The character sent to debug console

Returns
  None

Definition at line 373 of file retarget.c.

## ◆ SendChar_ToUART()

void SendChar_ToUART | ( | int | ch | ) |

Write a char to UART.

Parameters

  ch | The character sent to UART.

Returns
  None

Definition at line 353 of file retarget.c.

## ◆ stackDump()

void stackDump | ( | uint32_t | stack[] | ) |

Definition at line 51 of file retarget.c.

## Variable Documentation

## ◆ __stdin

FILE __stdin

Definition at line 47 of file retarget.c.

## ◆ __stdout

FILE __stdout

Definition at line 46 of file retarget.c.