Yes, i admit, i'm slow as a turtle. But as a turtle i've put out my head, and today out in direction to the blog! :)
Ok, jokes apart, in the previous step i've explaned how to get installed the needed tools to compile apps for our beloved Core controller, in this third step we will see how to get the SVN repository and then how to get and app compiled and ready as an .hex file to upload to our Pic Core, or Core32.
First thing is opening the Terminal.
Since the last step i assume that we get familiar with the Terminal window so i'll not explain where and how find it in our Macs!
Once you have the terminal opened, go to your home folder.
Usually when you open Terminal you're already on the Home folder, and you'll see your mac login name on the left of the cursor.
lsand hit return. You'll see a list of files and folder, open via finder your home folder, if you see that the files are the same you are surely in the home folder with the terminal. Otherwise you're in another folder and what you have to write in the terminal is the following command
cd Users/yourhomenameIt will bring you to the home folder. Home folder that will be the folder where we will put the mios, or mios32 repository. With Terminal opened write this command
svn co svn://svnmios.midibox.org/miosYou'll see that the Terminal will start to download all the repository files in a folder called mios in your home directory. We are downloading this repository in the home folder because we will have to set a .profile file needed to the compiling process. I'll explain his purpose later. Ok, when the Terminal have finished the download, we will see a folder called mios in our home with inside it two folders, trunk and playground. We will concentrate on trunk, the place were all what we need for our apps is placed. But, hey, we forgot the SVN32! Simple task, repeat the same command "svn co" but this time with the svn32 address:
svn co svn://svnmios.midibox.org/mios32At the end of the download you'll have the core32 repository, always in the home directory. Now we have both core and core32 repository in our home folder. You should see mios and mios32 folders. Well, start to compile! No. Do you remember the .profile file mentioned just before? We have to edit it so the tools installed in the Step 2 will work flawlessy. Don't ask me more about this, as i'm learning like you and sometimes i know that things must go in this way but i don't know why because i haven't yet understood all. I know that's not brilliant, but at the end i've the compiling process working! :) (i hope to explain better why to modify .profile page as soon as possible!) Let's go on modify our .profile page, you braves! On terminal write this command (be sure that you're in the home folder "/Users/yourhomename", not in another folder like mios or music ):
open .profileYou'll see a textedit file opened. Put at the top of the file this code if you are using the mios repository:
# mios export MIOS_PATH=/mios/trunk export MIOS_BIN_PATH=$MIOS_PATH/bin # mios endPut this code if you are using the mios32 repository:
# mios32 export PATH=$PATH:/usr/local/stm32/bin export MIOS32_PATH=/mios32/trunk export MIOS32_BIN_PATH=$MIOS32_PATH/bin export MIOS32_GCC_PREFIX=arm-none-eabi export MIOS32_FAMILY=STM32F10x export MIOS32_PROCESSOR=STM32F103RE export MIOS32_BOARD=MBHP_CORE_STM32 export MIOS32_LCD=clcd # mios32 endIf you're using both the repository put this:
# mios export MIOS_PATH=/mios/trunk export MIOS_BIN_PATH=$MIOS_PATH/bin # mios end # mios32 export PATH=$PATH:/usr/local/stm32/bin export MIOS32_PATH=/mios32/trunk export MIOS32_BIN_PATH=$MIOS32_PATH/bin export MIOS32_GCC_PREFIX=arm-none-eabi export MIOS32_FAMILY=STM32F10x export MIOS32_PROCESSOR=STM32F103RE export MIOS32_BOARD=MBHP_CORE_STM32 export MIOS32_LCD=clcd # mios32 endSave the file (cmd+S) and then close. Now, to refresh the system with the new .profile file we have to write this in the Terminal window:
. ~/.profileBe careful to include also the first dot! Best way copy and paste. ;) Once the .profile file is refreshed we can now go with our terminal to an app folder and try to compile it. But before i advice you to do always a backup of the folder that contains files needed to compile. My workflow is the following: I need to modify and compile the blm_scalar app. I copy the blm_scalar app folder in another backup folder, folder that can be placed anywhere outside the mios, or mios32 folders. I will have in this way an original copy of the svn downloaded one. Now that we have placed the original copy in a secure place we will start to go into our app target folder with the Terminal: When you are in the home folder with the Terminal write this command
cd mios/trunk/apps/controllers/blm_scalarYou'll be in the blm_scalar folder where all the .c, .h and makefile, needed for compiling, are located. Remember that you must go in an app single folder with Terminal to have the compiling process working. I mean, if you need to compile the midibox64 app, you will ahve to go to the midibox64 folder through the command
cd mios/trunk/apps/controllers/midibox64and so on for the other apps. I advice you to check out the apps and the relative folders path via finder, and then write the needed path in the terminal. Ok, returning to the our folder, blm_scalar, we are ready to compile our target app. You should have in terminal this position:
macname:blm_scalar yourhomename$What you have to do now is simply write in Terminal
makeThe terminal will print out some text and then the prompt will be back. And now? Check out what changed in the folder via the Terminal command
You can check out what changed also with finder going into the blm_scalar folder.
You should see that some files and a folder were created!
And....you should see project.hex, our compiled app ready to be uploaded to our core!
Ok, now that we had this file how we can upload to our core?
Simple, we will upload it using MIOS_Studio!
Download it from here, scroll the page to the bottom, you'll find the download links for mac and windows.
In the meantime that connect your Core board to your computer via midi, connecting both midi in and midi out.
Once the MIOS_Studio is downloaded, place it in your applications folder and then launch it.
Click over the browse button, go on the blm_scalar folder located in /"home"/mios/trunk/apps/controllers/blm_scalar, select the project.hex file and click ok.
Then click the start button and the progress bar will raise up with the upload of the project.hex file!
When finished your core will reboot and in the MIOS_Studio you will see a "ready" text!
You have now your app compiled and uploaded!
Consider that the same process is valid when you modify apps and the you'll upload them, is the same also if you are working with the mios32 svn.
But remember always to backup the apps folders and to check if the svn is updated!
I'll write about the modify of the app later as is something that i've not yet learned.
In the next step i'll write about the components needed for my specific controller project and write about some other thing that i'll think over in the next days/weeks! Remember the turtle! :)