Hi.
I try to make a code that must blink a led, but i receive some errors (see attache.).
This is my code :
#include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/fpu.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "driverlib/rom.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" static volatile uint32_t g_ui32Value; // The value that is to be modified via bit-banding. #ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { while(1) { UARTprintf("Error at line %d of %s\n", ui32Line, pcFilename); } } #endif // Delay for the specified number of seconds. // Depending upon the current SysTick value, the delay will be between N-1 and N seconds. void Delay(uint32_t ui32Seconds) { while(ui32Seconds--) { while(ROM_SysTickValueGet() > 1000) // Wait until the SysTick value is less than 1000. { } while(ROM_SysTickValueGet() < 1000) // Wait until the SysTick value is greater than 1000. { } } } void ConfigureUART(void) // Configure the UART and its pins. This must be called before UARTprintf(). { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Enable the GPIO Peripheral used by the UART. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // Enable UART0 ROM_GPIOPinConfigure(GPIO_PA0_U0RX); // Configure GPIO Pins for UART mode. ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); // Use the internal 16MHz oscillator as the UART clock source. UARTStdioConfig(0, 115200, 16000000); // Initialize the UART for console I/O. } int main(void) // This example demonstrates the use of bit-banding to set individual bits within a word of SRAM. { uint32_t ui32Errors, ui32Idx; ROM_FPULazyStackingEnable(); // Enable lazy stacking for interrupt handlers. // This allows floating-point instructions to be used within interrupt handlers, but at the expense of extra stack usage. ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Set the clocking to run directly from the crystal. ConfigureUART(); // Initialize the UART interface. UARTprintf("\033[2JBit banding...\n"); ROM_SysTickPeriodSet(ROM_SysCtlClockGet()); // Set up and enable the SysTick timer. The SysTick timer period will be set up for one second. ROM_SysTickEnable(); g_ui32Value = 0; // Set the value and error count to zero. ui32Errors = 0; UARTprintf("\r%08x", g_ui32Value); // Print the initial value to the UART. Delay(1); for(ui32Idx = 0; ui32Idx < 32; ui32Idx++) // Set the value to 0xdecafbad using bit band accesses to each individual bit. { HWREGBITW(&g_ui32Value, 31 - ui32Idx) = (0xdecafbad >> (31 - ui32Idx)) & 1; // Set this bit. UARTprintf("\r%08x", g_ui32Value); // Print the current value to the UART. Delay(1); } if(g_ui32Value != 0xdecafbad) // Make sure that the value is 0xdecafbad. { ui32Errors++; } for(ui32Idx = 0; ui32Idx < 32; ui32Idx++) // Make sure that the individual bits read back correctly. { if(HWREGBITW(&g_ui32Value, ui32Idx) != ((0xdecafbad >> ui32Idx) & 1)) { ui32Errors++; } } if(ui32Errors) // Print out the result. { UARTprintf("\nErrors!\n"); } else { UARTprintf("\nSuccess!\n"); } while(1) { } }