Code::Blocks

User forums => Embedded development => Topic started by: aashishgogna92 on August 03, 2018, 06:51:51 am

Title: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 03, 2018, 06:51:51 am
hello,
I am trying to build a GUI using emWin libraraies,windows 10,using IDE:codeblocks and the controller is STM32F429 cortex M4.
I have mingw32 and wxwidgets already installed on the windows 10.
libraries:emWin
IDE:codeblocks
environment: Windows 10
compiler: GNU ARM

query: how to install this toolchain so that i can update my global compiler settings while selection of "GNU GCC compiler for ARM" in settings>>compiler>>global compiler settings>>GNU GCC compiler for ARM>>toolchain executables>> i need to fill all the entries mentioned here.i am confused which executable file belong to which fillup section.
As the compiler and linker executable files are available in the bin folder of the downloaded toolchain but the resource compiler and make program files are not there in the bin folder.
will these files be available after doing some engineering on commmand prompt?

Downlaoded the tool chain from:
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: BlueHazzard on August 03, 2018, 11:42:51 am
I do not understand fully your question...

Do you have the arm compiler running? Can you build and upload a simple led blink with codeblocks to your controller?

Quote
query: how to install this toolchain so that i can update my global compiler settings while selection of "GNU GCC compiler for ARM" in settings>>compiler>>global compiler settings>>GNU GCC compiler for ARM>>toolchain executables>> i need to fill all the entries mentioned here.i am confused which executable file belong to which fillup section.
I do not understand this at all...
Do you have problems filling in the executable files for the compiler?
You can look at the normal gcc for example. If there is written "gcc.exe" you need something like "arm-noeabi-gcc.exe" ecc...
Quote
As the compiler and linker executable files are available in the bin folder of the downloaded toolchain but the resource compiler and make program files are not there in the bin folder.
resource compiler is not needed for arm target. This is only for windows targets.
make is also not needed if you use codeblocks as your build environment...

you only need
c compiler: arm-none-eabi-gcc.exe
c++ compiler: arm-none-eabi-g++.exe
linker for dynamic libs: arm-none-eabi-g++.exe
linker for static libs: arm-none-eabi-ar.exe
(not necessary:)
make: make.exe

Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 03, 2018, 12:07:30 pm
i have downloaded the compiler and in the bin folder these executable files are available, arm-none-eabi-addr2line,arm-none-eabi-ar,arm-none-eabi-as,arm-none-eabi-c++,c++filt,arm-none-eabi-gcc,arm-none-eabi-g++arm-none-eabi-,gdb,arm-none-eabi-gdb-py,lb,arm-none-eabi-nm etc etc.

i have just downloded the zip folder and extracted it,i am unaware that do i have to run gccvar (window batch file) and do some command stuff there to install this toolchain.(i dont know about the commands if required to install it or no installation is required)

NO,i cannot build any program because when i start making arm project ,codeblock error of no compiler tool-chain ,pops up!(i checked the gnu gcc compiler for ARM compiler for arm development and in global compiler setting i have tried to give path of these arm-none-eabi-g++,arm-none-eabi-gcc,arm-none-eabi-ar in the blank bar of respective files links)


i have checked through command prompt to check whether gcc compiler is installed or not, with this command gcc -v and it shows :

Target:mingw32
collect_gcc: gcc
thread model:posix
gcc version 5.1.0(tdm-1)
configured with: ../../src/gcc-5.1.0/configure --build=mingw32 --enable-languages=ada,c,c++,fortran, etc etc (all the required compilation options).

i know it is stupid to ask,mingw32 cannot be used for arm development? because i tried to give .exe path of mingw32 files during global compiler settings of code blocks and the similar message of the compiler toolchain not available on the selected path appeared/poped up again..

thanks for the reply :)

kindly help :)
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: BlueHazzard on August 03, 2018, 12:28:21 pm
1) Download: https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-win32.zip?revision=9b83e69c-e279-4d16-9401-990c836197b3?product=GNU%20Arm%20Embedded%20Toolchain,ZIP,,Windows,7-2018-q2-update
2) Extract zip file to c:\arm\gcc7
2.1) The folder c:\arm\gcc7 should looke like this:
Code: [Select]
c:\arm\gcc7
└───gcc-arm-none-eabi-7-2018-q2-update-win32
    ├───arm-none-eabi
    ├───bin
    ├───lib
    └───share
3) Open codeblocks
4) Settings->Compiler->Select  "GNU gcc compiler for ARM" from the dropdown
5) Swtich to tab "toolchain executables"
6) Compilers installation directory: c:\arm\gcc7\gcc-arm-none-eabi-7-2018-q2-update-win32
7) fill in the executables:
Code: [Select]
C compiler     =   arm-none-eabi-gcc.exe
C++ compiler =  arm-none-eabi-g++.exe
Linker for dynamic libraries = arm-none-eabi-g++.exe
Linker for static libraries     = arm-none-eabi-ar.exe
8) Hit OK

Now you have installed the GNU gcc for arm
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 03, 2018, 12:42:31 pm
Thank you for telling the procedure but the problem is still existing.

i did the same,now after doing this,
i clicked on file>>new>>project>>
Selected >>arm project>>go>>next>>named the project>>next>> now reaching this screen i see compiler tab with no option available.

even i clicked next>>Error appears saying "You must select a compiler for your project..."

kindly help :) :-X
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: BlueHazzard on August 03, 2018, 12:55:03 pm
Note: The ARM wizard is bad...  I never achieved it to produce runnable code for any arm.... I tried to fix it, but there where other problems i wanted to fix first...

Restart codeblocks and try again.

I will try to create a minimal example for arm stm. This will take some time.... (probably 1h or so...)
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 03, 2018, 01:15:30 pm
thank you so much for investing your time.

I am doing the same procedure to link this toolchain path through various names in the directories

eg:
C:/Program file(x86)/GNUARM and then copying whole toolchain so that it will be automatically detected.

result: same error appeared on codeblocks screen.

second way was:
the directory path you have suggested.
result: same error appeared on codeblocks screen.

(while trying any path i am deleting other options so that duplicate paths should not lie in the c:/ directory at one time)

repeatedly doing restarting clicking every possible way, all other projects are available,work,like console applications,avr projects,wxwidgets projects,sdl projects but the problem always come in ARM Projects.
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 03, 2018, 01:22:46 pm
i want to add one more thing if someone is trying to make a GUI On stm32f429 M4 or any cortex M using emWin libraries,
in the readme.txt it is clearly mentioned that it will run with these requirements :

1.Windows 2000 or later (correct i am having windows 10)
2.CodeBlocks IDE V10.05 (or later) for Windows and MinGW-compiler or (having both,but the confusion as its an arm project,mingw compiler is not automatically getting detected ,even manually trying on global compiler settings too not working ,same error)

3.Microsoft Visual Studio 2010 or later (optional,trying 2.)


please suggest what to do! :'( ::) :-X :-[
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: BlueHazzard on August 03, 2018, 02:44:53 pm
Ok, here is a example project:
https://github.com/bluehazzard/cb_minimal_STM32F429ZI

NOTE: I have only tried to compile. I have no STM32F429ZI to test the code....

Quote
1.Windows 2000 or later (correct i am having windows 10)
2.CodeBlocks IDE V10.05 (or later) for Windows and MinGW-compiler or (having both,but the confusion as its an arm project,mingw compiler is not automatically getting detected ,even manually trying on global compiler settings too not working ,same error)

3.Microsoft Visual Studio 2010 or later (optional,trying 2.)
this is probably only for the windows executables... If you want to use it on your arm you can also use makefiles or whatever....

EDIT: have you any idea what you are doing? If not, please tell us what you want to do... Compiler emWin on windows, for testing, or compiling emWin for arm and running it on your arm controller?
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 04, 2018, 06:14:39 am
 :-*
thankyou very much for helping . i never thought of using cubemx to make a project for codeblocks. i thought it is available only for eclipse and IAR. Thanks .

i have downloaded the code and it is building fine.thanks alot.

Yes i do know exactly what i want to do(Please help me if i am opting the wrong procedure or i am missing the link,kindly help).

Motive:

1. To design a GUI application on stm32f429 with the help of static libraries of emWin to use its functions like(GUI_Init(), CreateWindow(),GUI_Clear();
GUI_SetColor(aColor),
GUI_SetFont(&GUI_FontComic24B_ASCII), GUI_DispString("Hello world!"
), etc etc there are so many to design a basic button  and  then enabling the touch over it ).

2.while designing this project,as its a ARM controller so i need a ARM compiler installed?right,so i downloaded the compiler and was trying to install.From there the problem started.

i want to ask,the project you provided is working perfect and building,if it is building definitely it is using the arm-none-eabi compiler,How did the project itself is  detecting the compiler present in the windows while building the code even though its executable are not provided in the setting of its path manually(right now by me,i have just clicked on the C:B project and pressed build that is it).

thanks for helping ::) .



EDIT: i am using emwin for its >>static libraries  (STemWin532_CM0_GCC.a,STemWin532_CM3_GCC.a,STemWin532_CM4_GCC.a,STemWin532_CM7_GCC.a) as within these libraries only the source code of the GUI_Init() or other functions be available) . once the program which i am trying to write ,if successfully build with this libraries,then a smart screen will appear on my LCD?....

do you find any mistake in this approach?
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 04, 2018, 06:50:28 am
kindly tell me the procedure ,how did you made this project,i guess it is made using Cubemx ,but in my cubemx version,codeblocks ide is not listed 

Thanks ;D
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 04, 2018, 08:48:03 am

EDIT: have you any idea what you are doing? If not, please tell us what you want to do... Compiler emWin on windows, for testing, or compiling emWin for arm and running it on your arm controller?

i want to compile emwin for arm and run it on my arm controller.
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: stahta01 on August 04, 2018, 10:10:29 am
kindly tell me the procedure ,how did you made this project,i guess it is made using Cubemx ,but in my cubemx version,codeblocks ide is not listed 

Thanks ;D

He likely started from an empty Code::Blocks project and then add code and settings till it built correctly.

Tim S.
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 04, 2018, 12:16:43 pm


He likely started from an empty Code::Blocks project and then add code and settings till it built correctly.

Tim S.

actually the style of code in the project is made using some utility software later the post-pre buildcommands ,linker settings,alot of settings, linking objects, and a lot of non figure able information(at least to me) are manually input to the IDE.

thanks for providing the project.
 
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: stahta01 on August 04, 2018, 03:36:17 pm
Still he could have started with an empty CB Project and added text files from some external wizard or tool; after that added CB project settings.

Tim S.
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: BlueHazzard on August 04, 2018, 05:07:22 pm
kindly tell me the procedure ,how did you made this project,i guess it is made using Cubemx ,but in my cubemx version,codeblocks ide is not listed 

Thanks ;D

He likely started from an empty Code::Blocks project and then add code and settings till it built correctly.

Tim S.


exactly this was what i did... Inspect the makefile and make a codeblocks project from it.

CubeMX supports the export of ide independent files (the gpdsc export) and i have written a plugin that can import this files into codeblocks. Because with the project i posted at the top, if you change something in cube you have to change this manually in codeblocks project, and the include structure of the st stuff is TERRIBLE to say it kindly, and so you have way to much work to do... With the plugin this would be automatic...
Sadly the cube generated gpdsc file is by far not complete, and nearly useless, because many source files are missing (the whole cmsi thing for example) My import tool is finished and i plan to open source it on github as soon as the cleanup is done.

This tool is part of my embedded plan for codeblocks:
1) Import of gpdsc files (should work, but cube mx has bugs, i will try to find some time and ask in the st forum what the problem is....)
2) SVD file support for the debugger (plugin complete and works:  https://github.com/bluehazzard/cbSystemView But the current c::b is missing some features and i am waiting for feedback from the c::b devs to implement it in the debugger sdk.. see https://sourceforge.net/p/codeblocks/tickets/543/ and https://sourceforge.net/p/codeblocks/tickets/619/)
3) Better support for the SEGGER debugger platform (uploading code, reading flash, resetting uC ecc...) (i started the plugin and it kind of works, but there is some API missing in the codeblocks SDK and i have a discussion with the devs how to implement this .)
4) Probably some export plugin to use SEGGER ozon for debugging (but i am not happy with this, I would prefer to use codeblocks for debugging...)

Back to topic:
EDIT: i am using emwin for its >>static libraries  (STemWin532_CM0_GCC.a,STemWin532_CM3_GCC.a,STemWin532_CM4_GCC.a,STemWin532_CM7_GCC.a) as within these libraries only the source code of the GUI_Init() or other functions be available) . once the program which i am trying to write ,if successfully build with this libraries,then a smart screen will appear on my LCD?....

do you find any mistake in this approach?
1) You have to compiler the static libraries with the arm compiler and not with the mingw compiler!! (i don't know if you did that....)
2) i doubt that this is so easy.... Only way to find out is try it...
3) Can't you add the source code of emWin to the codeblocks project and let compile everything from source, so the compiler and linker can optimize more? As far as i have read in the emWin docs this should be possible (i have read maybe 10 pages....)


Quote
i want to ask,the project you provided is working perfect and building,if it is building definitely it is using the arm-none-eabi compiler,How did the project itself is  detecting the compiler present in the windows while building the code even though its executable are not provided in the setting of its path manually(right now by me,i have just clicked on the C:B project and pressed build that is it).
this really is a flaw in codeblocks and some time ago i tried to fix this by printing the used executables with full path....
You can look what compiler is set at the top of Project->Build options
And then you look at the path settings in the compiler settings under the above compiler...


greetings
Title: Re: How to install the GNU ARM compiler toolchain for codeblocks?
Post by: aashishgogna92 on August 06, 2018, 06:45:29 am
thanks, i am trying to understand all the aspects(codeblocks+debugging settings[manual pre-post build commands/enabling GDB CDB debugger/j-Link/etc ..)  , i will post the result once i succeed.


Thank you Sir, for the information!