We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi there:
A newbie question... I was able to use the HelloWorld example that was provided with the Keil for ARM compiler. I am now trying to do the same thing, only this time, instead of using LPC2106 I am trying to use LM3S6911 from Luminary Micro. Unfortunately, the way to do this, from what I can tell, is very different.
This is my code so far:
#include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #include "utils/uartstdio.h" //***************************************************************************** // //! \addtogroup example_list //! <h1>Hello World (hello)</h1> //! //! A very simple ''hello world'' example. It simply displays ''hello world'' //! on the UART and is a starting point for more complicated applications. //! //! UART0, connected to the FTDI virtual COM port and running at 115,200, //! 8-N-1, is used to display messages from this application. // //***************************************************************************** //***************************************************************************** // // The error routine that is called if the driver library encounters an error. // //***************************************************************************** #ifdef DEBUG void __error__(char *pcFilename, unsigned long ulLine) { } #endif int main(void) { // // Set the system clock to run at 8 MHz from the main oscillator. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_8MHZ | SYSCTL_OSC_MAIN); // // Enable the peripherals used by this example. // //SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); //SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); // // UART0: Set GPIO A0 and A1 as UART. // GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize UART0 as a console for text I/O. // UARTStdioInit(0); UARTprintf( "Hello, world!\n" ); UARTwrite("test",4); // // Print hello message to user. // while(1) { UARTprintf( "\nHello, world!\n" ); //printf("change!\n"); } }
Now, this compiles, links and executes without any error or warning, but I don't have any IO being shown. I am using the simulator (that is all I have for now).
I tried to SLOG >> out.txt, opened up all the UART windows, but the data does not seem to go anywhere, yet when I am executing under the control of the debugger, it seems to work fine.
I have several questions, many of which could be newbies:
1- I noticed that I am not including lm3s6911.h anywhere in there, yet it compiles fine. The defines in that header do not seem to be used anywhere. Is this normal?
2- Could it be that the simulator cannot do a HelloWorld program but the board could?
3- I am using all the latest StellarisWare includes and libraries.
If someone out there knows something about this and why I am failing, please let me know! I really gave it my best shot, and keep failing.
Steve
Sorry Andy... Good remark.
I just have tried many, many things over the weekend, but the situation is still the same.
As for the example in StellarisWare for the other board, it won't compile.
I checked each option as best as I could, still couldn't figure it out.
#include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #include "utils/uartstdio.h" //***************************************************************************** // //! \addtogroup example_list //! <h1>Hello World (hello)</h1> //! //! A very simple ''hello world'' example. It simply displays ''hello world'' //! on the UART and is a starting point for more complicated applications. //! //! UART0, connected to the FTDI virtual COM port and running at 115,200, //! 8-N-1, is used to display messages from this application. // //***************************************************************************** //***************************************************************************** // // The error routine that is called if the driver library encounters an error. // //***************************************************************************** #ifdef DEBUG void __error__(char *pcFilename, unsigned long ulLine) { } #endif int main(void) { // // Set the system clock to run at 8 MHz from the main oscillator. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_8MHZ | SYSCTL_OSC_MAIN); // // Enable the peripherals used by this example. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // UART0: Set GPIO A0 and A1 as UART. // GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize UART0 as a console for text I/O. // UARTStdioInit(0); UARTprintf( "Hello, world!\n" ); UARTwrite("test",4); // // Print hello message to user. // while(1) { UARTprintf( "\nHello, world!\n" ); } //for( ;; ) /* Stop here! */; }
As for the other post...
www.luminarymicro.com/.../
When I was explained that the code posted there should, in theory, work - at least on a board - then I thought posting to the Keil Web site may be more productive. Perhaps someone out there knows the simulator sufficiently to point me in the right direction.
Is that person you?
Also, here is my build output. I turned on all the warnings.
Build target 'Target 1' assembling Startup.s... compiling uartstdio.c... compiling main.c... linking... Program Size: Code=2456 RO-data=236 RW-data=8 ZI-data=256 "HelloWorld.axf" - 0 Error(s), 0 Warning(s).
Not sure if this is helpful. Just says what I am linking and that there is no error of any kind.
Hi,
a hint for the LMI devices:
Debug your application, and set a Breakpoint in the Fault handlers, especially the Hard Fault Handler. LMI goes there if - a peripheral is writte / read which is not clocked - a peripheral is clock enabled but still not ready (not enough __nop() between clkEnable and the first write)
Helps a lot!
BR, /th.
sorry for second post ... I forgot:
there is the CMSIS out, which has an ITM_Sendchar - function. This can be used to retarget fputc i.e., and printf debug messages to the printf viewer (see View -> Serial Windows).