Stm32 project to IAR - stm32

I have a project which is include STM32f4 HAL library and lots of code. And I have makefile for the this project.(Include gcc, g++)
I want to import my project into IAR Compiler. How can I do this without change my project. How can I convert it just by adding something on the project?

The STM32CubeMX code generation utility can generate IAR project files that work out of the box for your device. Manually adding your source file structure and custom settings (linker script, FPU etc) should be rather easy once you have that working minimal setup.

You will need to create a new project in IAR and add all the settings yourself. This is fairly straight forward and if you are not familiar with IAR it will help you learn. It is much simpler than makefiles. Of course IAR can work with makefiles as well but it is probably not the best place to start.
There will be a few compiler specific HAL files you will need to change (startup code). These are already in the STM32 HAL downloads.

Related

Platform.io - how to compile just library files, which are used in project

I'm using library ESP8266 audio, which contains lot of files. I'm using just a few of them, but when I want to build my project, platformio tryes to complie ewerything. It's quite issue, because unused filles has dependecies, which are not included in my project (eg. SD card library, file system library...). I can build my code with arduino IDE without any issues, but I'm not able to do the same thing in platformio. I tried to tweak src_filter flag, but it has no effect at all. I'm stucked on this for more than day and I wasn't able to find any relevant informations :/
Thank you for your answers.
Oh, I solved it myself! :D I have set 'lib_ldf_mode' to 'deep' on platformio.ini. It's now acts exactly as I need. It starts in 'src/' folder and then recursively compiles imports and imports of imports and so on.

Arduino with multiple libraries in Eclipse IDE

I have an Arduino code and want to continue programming in Eclipse IDE. Basically it consists of 2 main projects which use a lot of common, mostly self-written libraries and structs.
I want to include the two main projects and the libraries in Eclipse.
The problem is, that the compiler can't find the Libraries.
I already Googled a lot but didn't come to a working solution yet.
There are many possible solutions to this problem:
- Move the libraries to C:\Users\Andreas.arduinocdt\libaries - does not work.
- The best one: Set the Arduino Sketchbook location of the Eclipse Arduino IDE. But I can't find the location of this setting.
- Tell the compiler all location of the libraries.
- Write something ugly like this: #define INCLUDE_PATH(N) - But it doesn't work with external (downloaded) libraries or libraries consisting of multiple files.
But I didn't get any Solution to work.
Eclipse Version: 2020-03 (4.15.0)
Can you help me, please! Thank you very much!
Andreas
The current structure of the project. The SettingsGateway is one of many libraries.
Hi I ditched Eclipse for Arduino (microcontroller) development. I use a combination of ArduinoIDE wirh notepad++ as Editor (with plugins) and doxygen for documentation. I write code in C, C++, Javascript CSS, HTML so pretty different code bases. The "problem" with eclipse: it saves the libs woth the project, so if I change something in a lib I have found so far no easy way to automaticlly distribute it to the other projects using the same lib.>br>I am sure there is some plugin, but my job is to code and not to readd ocumentation of an ever changing IDE. If you stay with eclipse for Arduino Sloeber is your easiest option: http://eclipse.baeyens.it/index.shtml Everything together in a central place, you can then install other modules if needed

How can I add I-CUBE-LRWAN libraries to a new project?

I am working with STM32 B-L072Z-LRWAN1 discovery kit. How can I add I-CUBE-LRWAN libraries externally, after i have created a project on CubeMX for B-L072Z-LRWAN1 discovery kit. Because project which i have created have not radio libraries. I am coding with System Workbench.
Before this project, i used Ping-Pong example. It was divergent for create a fresh project. So i am trying to make a new project for Lora.
Thanks for answers.
I'm going to answer it from te point of view of a Keil project because that is the program wherein I've done it but these steps should be interchangeable with the IDE. It mostly involves copying the code and adding the right linker and source paths.
The I-CUBE-LRWAN project has been setup such as that the parts of the project have been separated. The root directory of the project consists of three folders: Middlewares, Projects and Drivers. These folders contain both .h and .c files inside their tree structure.
Drivers
The Drivers folder contains all the files related to the specific board you are using, the HAL (Hardware Abstraction Layer), CMSIS and the BSP (Board Support Package). The HAL and CMSIS provide a generalized interface towards the device and when using these creates code that can be ported to other STM32 platforms by changing out the CMSIS board specific definitions. I would recommend that when you create a project you tick the box to include all library files in your project. This will make compilation take longer and your project bigger but will also prevent you from fussing about with missing libraries. The BSP contains Board Specific interfaces for interfaces present on your platform. This includes LEDs and buttons on the L072Z-LRWAN1 and in case of the STM32l4 nucleo the joystick/LCD.
I would recommend that you copy your board specific BSP (.h and .c) into your project and use them as a standardized interface to board specific features. You should create a new BSP .h/.c pair when you are using a custom board.
Projects
The Projects contains your project specific code and contains the business end of your application. A bit of a bump in the road comes up here as ST has chosen to implement all their LoRaWAN code inside the main.c file. I would recommend that you take out all the LoRaWAN related initialization and transmission code (generally anything related to LoRaMainCallback_t) and put it inside a separate file with a defined interface. This is a bit of work but will pay dividend in the fact that your normal code has been separated from your LoRaWAN handling. I've stored my LoRaWAN code inside the file lorawan.<h|c>. With regard to the rest of the files: move the contents to a separate folders in your project called LoRaWAN/App/inc/ and LoRaWAN/App/src/. This pertains to the files: debug.c, hw_gpio.c, hw_rtc.c, hw_rtc.c, vcom.c, debug.h, hw.h, hw_conf.h, hw_gpio.h, hw_msp.h, hw_rtc.h, hw_spi.h, utilities_conf.h and vcom.h. Add the inc folder to your include path (the -I option) and the source files to your project.
Middlewares
The Middlewares folder needs to be copied from the source project to your target project and every inc folder or folder with .h files needs to be added to your include path and every source file needs to be added to your project. I would recommend that the folder structure is kept inside your IDE as to make your navigation between project and folder structure easier.
Another postive effect of keeping the folder structures similar is that upgrading your code with a newer stack should be easier as the files can be found in a somewhat same place in both projects.
Preprocessor defines
And a most important step. You need to take the DEFINE parameters defined inside the project and copy the into your own project. This can be found inside the Keil project (and the other projects also but in other places) under: options for target x->C/C++->define. It contains something akin to these values: STM32L072xx,USE_B_<board name>,USE_HAL_DRIVER,REGION_EU868,DEBUG,TRACE. As you can see I'm using: a Murata radio with integrated STM32, the EU 868 region and debugging and tracing options.
It should be possible to include "hw.h" and compile your program when you've done everything right.

How do I generate code in STM32 CUBEMX?

I have downloaded Keil and STM32 CUBEMX (Together with firmware library for my microcontroller).
I don't understand how do I put my c code to see what is really going on?
I tried connecting Keil with STM32 Cubemx when creatning new project, but when I go to device there is no STM32 Cube, what should I do?
You can't just drop a preexisting project into CubeMX and expect it to sort out what you're trying to do - CubeMX is a code generator for initialization of the hardware, and that's it.
To do what you're trying to do, you need to configure the peripherals as you'd like for your project in CubeMX, have CubeMX generate the project from that (CubeMX can generate projects for a variety of IDEs, including Keil), and then open that project in your IDE and edit in the specifics of your project as you'd like, starting from the generated main function.
Remember to only modify the parts of the generated files between the "USER CODE" comment lines, and not modify those comments if you think you'll ever want to change the project settings you set up in CubeMX - the generator uses those comments to ensure that it doesn't overwrite user code while regenerating the project.
I just want to add that now there is a STM32 Cube IDE which combines the MX with an IDE, so you can generate the code and go to the editor without any problem. No need to use Keil, or any other IDE

How does Qt Creator shape up against Eclipse CDT?

Qt Creator looks like a good IDE. I've been using Eclipse CDT and while a little buggy, it does the job.
Does Qt Creator have the same capabilities as Eclipse CDT?
Qt Creator uses MinGW under the hood, so it only makes sense that it would be able to compile without using any Qt headers. Simply uncheck all of the headers when making the project and you can code just like you would in any other IDE.
I took an example shot for you to see:
Dead link
Edit: Ahh you edited your question.
Yes of course! Qt is a great environment and can sure hold it's own against competitors like Eclipse in C++. Although keep in mind Eclipse satisfies a myriad of developers, from Java to C++ to Python among many others. Typically an IDE specializing in one language will be more catered to that language, but Eclipse sure does one hell of a job catering to developers of multiple languages with it's vast amount of plugins. If you're comfortable with Eclipse CDT, I think you will feel right at home with Qt Creator, better yet, pampered.
such a great piece of software.
Well, QTCreator does exactly what a Linux C++/C dev (i assume you are a linux dev from what i read) would want from an IDE. Neither too much nor too little features. The problem of feature rich IDEs like Eclipse is that you might loose control of your project since it pretty much handles everything. If something goes south you have to take the features/plugins you used into consideration during the debugging process.
But overall, eclipse is (imho) the better choice since it makes sense to get used to one IDE that can pretty much handle every language. At work i use eclipse CDT for exactly this reason. For private projects i use QTCreator, because C/C++ are the only languages i use for these projects.
I hope this helps
Since you mentioned nothing about Qt, I assume that you plan to use QtCreator for a non-Qt C++ project, with its own custom Makefiles, not qmake-based, not Eclipse-CDT-based.
After I switched to QtCreator (now working on the same project, same code) I noticed the following advantages of QtCreator:
QtCreator moves faster than EclipseCDT for the same C/C++ project.
EclipseCDT is harder to config with custom Makefiles. QtCreator is easier. This is the case when you checkout a project with its own custom Makefiles, not IDE-generated ones, and you need to map that project's build targets to EclipseCDT build targets/configurations.
It's easier to deal with .pro(ject) files in QtCreator than workspaces in EclipseCDT.
In my case, the EclipseCDT memory footprint after indexing is about ~2GB. For QtCreator, it is only ~600MB, for the same project.
Source indexing in EclipseCDT takes a lot of time - when I start EclipseCDT, my computer is frozen for about 20 minutes due to indexing. In QtCreator it takes a quarter of that time, and the computer is responsive during it.
Of course there are a lot of advantages that EclipseCDT offers like the plethora of plugins (EGit, Subclipse, cppcheclipse, etc), but it depends if you really use them.
In the end, I think it's a matter of personal taste and habit, as you can achieve your goals with each of them.