Jump to content

Building OutOfBox_EmulStorageKeyboard With mspgcc

Recommended Posts

Hi all, I'm attempting to build the out-of-the-box keyboard emulator demo for the f5529 launchpad (available here) with mspgcc. But naturally, being a newbie, I've run into some trouble. The big idea here is to transplant the keyboard system from the example and use it to benchmark Project Euler solutions on the MSP430 (i.e. do the computation, spit the results into a text file).

My approach has been to use the following makefile in the project source directory. I've been able to use it to build and flash blinky projects to the launchpad, but nothing more complicated.

CFLAGS=-I. -Os -g -Wall -mmcu=$(MCU)
LDFLAGS=-g -mmcu=$(MCU)

	@echo linking: $(PROJ).elf
	$(CC) $(LDFLAGS) -o $(PROJ).elf $(OBJS)
	@echo  "--== Size of firmware ==--"
	msp430-size $(PROJ).elf
%.o:%.c %.h
	@echo compiling file: $<
	$(CC) $(CFLAGS) -c $<

	@echo cleaning $<
	rm -fr $(PROJ).elf $(OBJS)

flash: all
	mspdebug tilib 'erase' 'load $(PROJ).elf' 'exit'

When I run the following, I get some funky errors. A whole lot of these (with different unfamiliar data types):

In file included from main.c:91:0:USB_API/USB_Common/usb.h:176:1: error: unknown type name 
Link to post
Share on other sites

The __no_init problem is because TI compiler has it as a built-in clause that marks the variable to be in un-initialized RAM.


To patch that you could edit the file



and append below the section


something like


#ifdef __MSP430__

#define __no_init

#define __data16

#define __even_in_range(x,y) x



I know it's dirty and far from optimal. Defining __no_init as nothing does nothing to put it in un-initialized memory segment... but at the time it worked and never touched again. Don't know if __even_in_range is properly implemented in newer versions of mspgcc


I believe that __MSP430__ symbol is defined automatically by using msp430-gcc, not quite sure about that. If it's not the case you will have to define the symbol when calling gcc:

msp430-gcc -D__MSP430__ etc


I do that in an old version of usb api, now I have downloaded the latest version, and I think you should be ok if you define the symbol



About the descriptors.h error, have you generated the USB_config files with the descriptor tool?. You should have those in a /USB_config folder inside your project

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...