Anish 0 Posted August 9, 2013 Share Posted August 9, 2013 Hi, I am using Linux and I've installed arm-none-eabi-gcc toolchain and lm4flash. Now, I also extrated the stellarisware at ~/stellaris/ Now, when i run the examples givin in the stellarisware like blinky.bin using lm4flash, it works fine. But when i create my own programs (from the stellaris workshop files), how do i compile them and create a .bin file? I mean i need to commands to do them. I tried the commands from recursivelabs: http://recursive-labs.com/blog/2012/10/28/stellaris-launchpad-gnu-linux-getting-started/ When i run those commands, i get errors as follows: [anish@thinkpad stellaris]$ arm-none-eabi-gcc myfirstlab.c startup_gcc.c -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall -pedantic -DPART_LM4F120H5QR -c -I/home/anish/stellaris -DTARGET_IS_BLIZZARD_RA1 myfirstlab.c: In function 'main': myfirstlab.c:10:2: warning: implicit declaration of function 'ROM_SysCtlClockSet' [-Wimplicit-function-declaration] ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ^ myfirstlab.c:12:2: warning: implicit declaration of function 'ROM_SysCtlPeripheralEnable' [-Wimplicit-function-declaration] ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ^ myfirstlab.c:13:2: warning: implicit declaration of function 'ROM_GPIOPinTypeGPIOOutput' [-Wimplicit-function-declaration] ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); ^ myfirstlab.c:17:3: warning: implicit declaration of function 'ROM_GPIOinWrite' [-Wimplicit-function-declaration] ROM_GPIOinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, PinData); ^ myfirstlab.c:18:3: warning: implicit declaration of function 'ROM_SysCtlDelay' [-Wimplicit-function-declaration] ROM_SysCtlDelay(2000000); ^ [anish@thinkpad stellaris]$ arm-none-eabi-ld -T blink.ld --entry ResetISR -o a.out startup_gcc.o myfirstlab.o --gc-sections myfirstlab.o: In function `main': /home/anish/workspace/stellaris/myfirstlab.c:10: undefined reference to `ROM_SysCtlClockSet' /home/anish/workspace/stellaris/myfirstlab.c:12: undefined reference to `ROM_SysCtlPeripheralEnable' /home/anish/workspace/stellaris/myfirstlab.c:13: undefined reference to `ROM_GPIOPinTypeGPIOOutput' /home/anish/workspace/stellaris/myfirstlab.c:17: undefined reference to `ROM_GPIOinWrite' /home/anish/workspace/stellaris/myfirstlab.c:18: undefined reference to `ROM_SysCtlDelay' /home/anish/workspace/stellaris/myfirstlab.c:19: undefined reference to `ROM_GPIOinWrite' /home/anish/workspace/stellaris/myfirstlab.c:20: undefined reference to `ROM_SysCtlDelay' [anish@thinkpad stellaris]$ Where am i going wrong/what am i missing? Thanks Quote Link to post Share on other sites
szymekrak1426459900 0 Posted August 9, 2013 Share Posted August 9, 2013 Could you please upload myfirstlab.c? Do the functions without ROM_ prefix work? Quote Link to post Share on other sites
Ekami 0 Posted August 14, 2013 Share Posted August 14, 2013 Here is a simple project with Makefile which is actually working for me: File: Makefile SRC= startup_gcc.c \ blink.c OBJS= $(SRC:.c=.o) NAME= blink.bin CC= arm-none-eabi-gcc LD= arm-none-eabi-ld OBJCPY= arm-none-eabi-objcopy INC= $(STELLARISWARE) CFLAGS= -I$(INC) -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-section\ s -fdata-sections -MD -std=c99 -Wall -pedantic -DPART_LM4F120H5QR -c -DTARGET_IS_BLIZZARD_RA1 $(NAME): $(OBJS) $(LD) -T ldStart.ld --entry ResetISR -o a.out $(OBJS) --gc-sections $(OBJCPY) -O binary a.out $(NAME) clean: rm -vf $(OBJS) $(NAME) *.d *.out File: ldStart.ld MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 } SECTIONS { .text : { _text = .; KEEP(*(.isr_vector)) *(.text*) *(.rodata*) _etext = .; } > FLASH .data : AT(ADDR(.text) + SIZEOF(.text)) { _data = .; *(vtable) *(.data*) _edata = .; } > SRAM .bss : { _bss = .; *(.bss*) *(COMMON) _ebss = .; } > SRAM } File: blink.c #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #define LED_RED GPIO_PIN_1 #define LED_BLUE GPIO_PIN_2 #define LED_GREEN GPIO_PIN_3 int main() { ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); for (; { // set the red LED pin high, others low ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, LED_RED); ROM_SysCtlDelay(5000000); ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE, 0); ROM_SysCtlDelay(5000000); } } File: startup_gcc.c http://www2.zshares.net/jli429a08wzl or you can find it into your ~/StellarisWare/boards/ek-lm4f120xl/blinky/startup_gcc.c Refer yourself to this Makefile/Project to see if you don't have something missing. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.