Exemple #1
0
int main(void)
{
    // Set the clock to run from the crystal at 8Mhz
    SysCtlClockSet (SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                    SYSCTL_XTAL_8MHZ);

    // Initialise the OLED display.
    RIT128x96x4Init (1000000);

    // Initialise UART
    uart_initialise ();

    long i = 0;

    char string[50] = {0};

    long length = ((char) UARTCharGet (UART0_BASE)) - 48;

    while (i < length)
    {
        string[i] = ((char)UARTCharGet (UART0_BASE));
        i++;
    }
    string[i] = '\0';

    vulncpy (string);

}
Exemple #2
0
/**
 * @brief Initialize the system
 *
 * Setup the microcontroller system.
 */
void SystemInit(void) {
   /* This is generic initialization code */
   /* It may not be correct for a specific target */

   /* Use Clock initialisation - if present */
   clock_initialise();

   /* Use UART initialisation - if present */
   uart_initialise(DEFAULT_BAUD_RATE);

   /* Use RTC initialisation - if present */
   rtc_initialise();

#if defined (__VFP_FP__) && !defined(__SOFTFP__)
   /* Initialise FPU if present & in use */
   __asm__ (
         "  .equ CPACR, 0xE000ED88     \n"
         "                             \n"
         "  LDR.W R0, =CPACR           \n"  // CPACR address
         "  LDR R1, [R0]               \n"  // Read CPACR
         "  ORR R1, R1, #(0xF << 20)   \n"  // Enable CP10 and CP11 coprocessors
         "  STR R1, [R0]               \n"  // Write back the modified value to the CPACR
         "  DSB                        \n"  // Wait for store to complete"
         "  ISB                        \n"  // Reset pipeline now the FPU is enabled
   );
#endif
}
/**
 * @brief Initialize the system
 *
 * Setup the microcontroller system.
 */
void SystemInit(void) {
   /* This is generic initialization code */
   /* It may not be correct for a specific target */

   /* Use Clock initialisation - if present */
   clock_initialise();

   /* Use UART initialisation - if present */
   uart_initialise(19200);

   /* Use RTC initialisation - if present */
   rtc_initialise();

}