cancel
Showing results for 
Search instead for 
Did you mean: 

overwhelmed

peterharrison9
Associate II
Posted on May 11, 2009 at 19:55

overwhelmed

4 REPLIES 4
peterharrison9
Associate II
Posted on May 17, 2011 at 13:12

Hi

I have my compiler all set up from CodeSourcery Lite. it is running on a Mac. I am pretty confident that it is all appropriately installed.

I have dabbled with some very simple one file programs and they build just fine and download to my STM32-SK just fine.

This evening, I downloaded the V3 Peripheral library package from ST.

Now I see that I am in proper trouble. So many files and so many folders. I hardly know where to start. It seems so complicated that I am tempted to write my own processor header file and be done with it since that looks easier than trying to comprehend the library.

I can't even find a linker script.

I looked at some of the examples, read the readme and copied in appropriate files as requested, and their header files. Then I found I had to hunt around for a bunch of other stuff like the start-up code, platform_config.h, core_cm3, stm32f10x.h and a couple of others. It won't build, complaining about implicit definitions of assert_param even though the macros look fine to me.

Can anyone guide me in this?

Surely, I shouldn't have to keep copying files into a project directory to make stuff. I don't really want to copy the library about - what if I change it?

I really would like to be able to do all this with makefiles and a text editor.

Pete

rael
Associate II
Posted on May 17, 2011 at 13:12

Only just been in a near similiar position to you.

I've been using the raisonance toolset, which has files a bit different from the STM official ones.

I bought an XP EEEBOX for a server for the machine I'm building, and have my tools loaded to it, simplifies things a bit.

These are the critical files I loaded to my main.c directory:

main.c

stm32f10x_conf.h mostly used for activating pheripherals.

stm32f10x_map.h typedef structures and memory labeling of pheripheral mapping.

stm32f10x_lib.h contains the library file names, active or commented out.

miles
Associate II
Posted on May 17, 2011 at 13:12

Quote:

Can anyone guide me in this?

Surely, I shouldn't have to keep copying files into a project directory to make stuff. I don't really want to copy the library about - what if I change it?

I really would like to be able to do all this with makefiles and a text editor.

Pete

Instead of copying header files, make a variable in your makefile called INCPATH, set it to a space-delimited list of include paths like this:

INCPATH += -I$(STM32ROOT)/FreeRTOS/Source/include

INCPATH += -I$(STM32ROOT)/Rowley/ARM/include -I.

INCPATH += -I$(STM32ROOT)/fwlib/inc

and then pass that variable to your compiler like $(INCPATH) (the same as how the ''STM32ROOT'' variable is evaluated). That's how you specify a #include search path to gcc. In my example above, I added directories for FreeRTOS (the operating system I use on STM32), Rowley files (I use the Rowley toolchain), the current directory (which is what ''.'' means), and the ST Micro STM32 firmware library.

If you want to find C source code files that aren't in your current directory, instead of copying them to the current directory, you can either put the exact path to them in a makefile build rule, or you can modify your VPATH variable. I have stuff like this for mine:

vpath %.c $(STM32ROOT)/fwlib/src

vpath %.s $(STM32ROOT)/Rowley/ARM/source/ $(STM32ROOT)/Rowley/ARM/targets/ST_STM32F10x/

vpath %.c $(STM32ROOT)/FreeRTOS/Source $(STM32ROOT)/FreeRTOS/Source/portable/GCC/ARM_CM3 $(STM32ROOT)/FreeRTOS/Source/portable/MemMang

...STM32ROOT is just a variable I made up to use in my Makefiles, and it was defined like this:

STM32ROOT=$(BUILDROOT)/software/STM32

where BUILDROOT is another makefile variable, that is used by makefile for my STM32 projects, as well as 8051 projects, and PC applications.

Makefiles can be tricky, but if you google for things like ''makefile vpath'' you'll find tons of info.

Good luck, and post again if you get stuck, or perhaps on a GNU make mailing list or IRC channel on freenode. Build systems are hard, and I'm by no means an expert, I've just picked up some knowledge as I went along.

- Miles

peterharrison9
Associate II
Posted on May 17, 2011 at 13:12

Excellent. I was unaware of the vpath variable. It looks like exactly what I will need.

Thank you

Pete