Skip to content

STM32 Template Project

I’ve been looking for a while for a template project to use with my STM32-P103 board.
In the STM32 Standard Peripheral Library there is a template project for most IDEs used in embedded dev. However I was looking for a project to use with CodeSourcery ARM-GCC toolchain.

You can find the repository here:
hg clone http://bitbucket.org/corfr/stm32template

  • Just clone it, and you will have the “base”
  • Then edit the Makefile to specify your PROJECT_NAME
  • Eventually change TC_PREFIX to specity the path of your toolchain
  • Run make to make the project, then make program to program the target.

To debug the project, you can run make debug to launch openocd. Then you will have to connect to the openocd server on port localhost:3333 .

Without GUI for gdb, just do:

arm-none-eabi-gdb --eval-command="target remote localhost:3333"

It should run gdb in command line and connect to the target (you must have openocd running along).

I’m used to Eclipse, so I use Zylin CDT plugin with Galileo. Make a new debug configuration using “Zylin embedded debug (Native)” base, and in the “Commands” tab, put “target remote localhost:3333” in Initialize. In “C/C++ Application”, select the .axf file.

The project is configured to work with the Amontec JTAGkey and is just setting up USART2 (on board serial port) and blinking Status LED.

I’m opened to any suggestion for that template, feel free to comment.

You can also find other templates, like that one from outroot STM32 Project template for HD devices.

One Comment

  1. % %

    Amazing, wonderful article.Thanks again. Great.

Leave a Reply

Your email address will not be published. Required fields are marked *

Click to Insert Smiley

SmileBig SmileGrinLaughFrownBig FrownCryNeutralWinkKissRazzChicCoolAngryReally AngryConfusedQuestionThinkingPainShockYesNoLOLSillyBeautyLashesCuteShyBlushKissedIn LoveDroolGiggleSnickerHeh!SmirkWiltWeepIDKStruggleSide FrownDazedHypnotizedSweatEek!Roll EyesSarcasmDisdainSmugMoney MouthFoot in MouthShut MouthQuietShameBeat UpMeanEvil GrinGrit TeethShoutPissed OffReally PissedMad RazzDrunken RazzSickYawnSleepyDanceClapJumpHandshakeHigh FiveHug LeftHug RightKiss BlowKissingByeGo AwayCall MeOn the PhoneSecretMeetingWavingStopTime OutTalk to the HandLoserLyingDOH!Fingers CrossedWaitingSuspenseTremblePrayWorshipStarvingEatVictoryCurseAlienAngelClownCowboyCyclopsDevilDoctorFemale FighterMale FighterMohawkMusicNerdPartyPirateSkywalkerSnowmanSoldierVampireZombie KillerGhostSkeletonBunnyCatCat 2ChickChickenChicken 2CowCow 2DogDog 2DuckGoatHippoKoalaLionMonkeyMonkey 2MousePandaPigPig 2SheepSheep 2ReindeerSnailTigerTurtleBeerDrinkLiquorCoffeeCakePizzaWatermelonBowlPlateCanFemaleMaleHeartBroken HeartRoseDead RosePeaceYin YangUS FlagMoonStarSunCloudyRainThunderUmbrellaRainbowMusic NoteAirplaneCarIslandAnnouncebrbMailCellPhoneCameraFilmTVClockLampSearchCoinsComputerConsolePresentSoccerCloverPumpkinBombHammerKnifeHandcuffsPillPoopCigarette