I am wondering, is it possible to add CMSIS and HAL libraries at the same project in KEIL...
based on my knowledge I added CMSIS libraries in different folder but in compiling I got these errors...
Do you guys have faced with this problem?
Can you help me?
note: the main project was written in CMSIS and I don't want to rewrite it in Hal.
There are 2 files:1-stm32f4xx_hal.h,2-stm32f4xx.h
The first one is defined and used in HAL and the second one is for CMSIS, how can I use both of them in one project?
THIS IS THE ERROR:" #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)" "
and in below is the screenshot.
THANKS.
The STM32 HAL always depends on CMSIS. You cannot use the HAL library without CMSIS.
The error message you have received clearly explains what you have done wrong and what you need to do to fix it. I cannot explain it any more clearly than that.
#error Please select first the target STM32F4xx device used in your application
You might also appreciate to read the comment immediately before the line you have highlighted:
/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/
Related
This question already has answers here:
CMSIS & STM32, How to begin? [closed]
(2 answers)
Closed 1 year ago.
As I want to write an efficient program to use minimal RAM & Flash, I want to remove HAL library completely from my project & program only in registers.
I want to use cubeIDE for compiling & Debugging but I do not know how to remove HAL library from my project(It seems that HAL library created and attached to project by default when generating project).
Is there any practical way?
Best!
There is an option in STM32CubeIDE project generation which allows you to create empty projects.
The empty project comes with the following:
main.c : Mostly empty
syscalls.c : I don't know what it is for but probably useless.
sysmem.c : Implements _sbrk() function, which is used by malloc() & new()
startup_stm32[xxxxxxxx].s : Startup file in assembly. You can leave it as it is
[xxxxxx]_FLASH.ld : Linker script file. Most of the time, this can be left unchanged.
But you need some additional libraries & files.
CMSIS Library : This includes some core functions common to all Cortex M devices. The core library is header only, and it's the only one you need to get started. There are some additional CMSIS libraries, like the DSP library which you may need depending on your project requirements. I suggest downloading it from its official repository.
Official STM32 headers from ST : This is actually called STM32Cube[xx] (STM32CubeF4 for example) and includes the Cube & HAL framework you want to get rid off. But we're interested in CMSIS compliant device headers. You can delete the rest. It also includes a version of CMSIS which lags behind the official one. Since you can download the latest CMSIS from its official repository, you don't need the one included in Cube package. You can download the relevant package from ST. For example, this one is for F4 series.
Once you have the needed packages, you need to configure STM32CubeIDE such that your project uses the newly obtained libraries. Basically, you need to add some additional include directories and symbol definitions. And there is an additional system_stm32[xxxxx].c file, which can be found in STM32Cube package and needs to be included in your project.
Here you can find a somewhat related answer.
Here is an example STM32CubeIDE blinky project I've created for the Blue Pill board (STM32F103C8). It may be somewhat outdated but it's probably still useful.
The method I've described probably isn't very practical. Some people suggest creating a normal Cube & HAL project and than pruning the unused parts.
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
I'm pretty new to c++ (and programming in general) and I'm currently trying to inlcude the "SDL.h" header into a c++ project in Eclipse (I use minGW btw). I've provided the project with the paths to the the header files and the library of SDL. However, whenver I specifically include "SDL.h" and the build then project I get the following Message:
" 'Launching SDL Basic.exe' has encountered a problem. Program file does not exist. "
I'm pretty sure that this has to do with the fact that no .exe file is generated whenever I build the project with SDL.h included. What I don't get is why this happens. When I include some other SDL header, such as SDL_assert, this is not a problem. Then the .exe file is generated just as usual and the program runs just as it should.[enter image description here][1]
http://i.stack.imgur.com/cdV8U.jpg How it looks when SDL.h is included.
http://i.stack.imgur.com/MW7PX.jpg How it looks when something else from SDL is included.
I seem to have fixed the problem. Whenever I ran the program the console window outout " undefined reference to 'Winmain#16' ". So I googled on it and found out that SDL defines its own main function in SDL_main.h, which in total would give me two main functions. To prevent SDL from defining its own main function I had to define the macro SDL_MAIN_HANDLED before I included SDL.h, and look, it worked:
http://i.stack.imgur.com/mNOOE.jpg
If someone can explain this in more detail I'd really appreciate it.
I did a little research and it looks like the undefined reference to WinMain#16 is because SDL is automatically creating a Windows entry point for your application, but you haven't provided the necessary libraries to link in the SDL implementation of that entry point. However, if you intend to use the SDL functionality, you really do need that entry point, because it performs several important initialization steps necessary to leverage the SDL features that you presumably want to use.
Defining SDL_MAIN_HANDLED is a mechanism that would allow you to provide your own Windows entry point (i.e.: WinMain), but that is a more complicated approach (albeit more flexible). This only solves your problem because it happens to prevent "main" from being redefined to "SDL_main" which in turn means that your .cpp file no longer even requires any of the SDL libraries. So it compiles and links, but you won't have any of the SDL functionality you're looking for.
You need to link in the appropriate libraries. See here - it provides some info that might help.
I'm trying compile the lastest WebRTC version for iPhone. I not need to compile the entire solution, I only need to compile the VAD module.
To do that, I have created a Xcode project and I have tried to compile the source necessary, but I have a problem with the *.s files and its assembler.
Like in the FFMPEG library, I know that I must "translate" the assembler code to an assembler code that the gcc for iPhone understand, but I don't know how I do this manually.
I have tried to create a configure file and set in it "as=gas-preprocessor.pl" (like in FFMPEG), but does not work.
Any idea? How do I run the gas-preprocessor.pl manually?
Thanks.
I'm just finishing it on iOS and has built standalone static libraries of NS/VAD/AECM and AGC, here's some tips for you, and hope you success:
1. Source File List
for standalone VAD build, you should make sure your project has all of these files(no .s file needed), and I'm not listed the header files here, you will get some header file can not be found errors, just fixing it and things will be done.)
webrtc_vad.c
vad_core.c
vad_filterbank.c
vad_gmm.c
vad_sp.c
real_fft.c
division_operations.c
complex_bit_reverse.c
cross_correlation.c
complex_fft.c
downsample_fast.c
vector_scaling_operations.c
get_scaling_square.c
energy.c
min_max_operations.c
spl_init.c
2. Adding a macro called WEBRTC_MAC
I'm not sure why the Xcode environment does not provide this macro, but it should be defined to ensure that WEBRTC_POSIX is enabled. To define this macro, adding it to a new header file or just define it in the webrtc-header-files.
3. Following these steps to build and setup a static library of WebRTC-VAD module on iOS
notice, do not use LLVM 2.0 to compile the VAD module(use GCC or LLVM GCC). cus' it can throw you lots of errors when compiling some webrtc variable declarations.
4. Using the libwebrtc_vad.a
if you got this far, things are easy to go, just include webrtc_vad.h and using the API provided by this module. and vad is working fine in my case.
hope i helped.
try to check this link https://groups.google.com/forum/?fromgroups=#!topic/discuss-webrtc/VJg-fk2-i_0 i believe you have to set inline assembly correctly. I am also onto this so let me know if you want to switch emails or something.
I want to use eclipse for Arduino development and I have some issues.
I use Eclipse + Eclipse AVR plugin + WinAVR. I managed to compile the Arduino core library into a static library.
Now I want to use my ethernet shield but I can't find a way to use the ethernet library with Eclipse.
Copied the folder from arduino-022/libraries/Ethernet and arduino-022/libraries/SPI to my project folder and then I made some changes to the includes in order to work. The result is some errors about DDRB and PORTB.
Added the folders Ethernet and SPI into the project's include path. The result is the following.
main.cpp:(.text+0x8): undefined reference to `Server::Server(unsigned int)'
./main.o: In function `loop':
main.cpp:(.text+0x36): undefined reference to `Server::available()'
main.cpp:(.text+0x3c): undefined reference to `Client::operator bool()'
main.cpp:(.text+0x56): undefined reference to `Client::available()'
main.cpp:(.text+0x64): undefined reference to `Client::read()'
main.cpp:(.text+0xf6): undefined reference to `Client::connected()'
main.cpp:(.text+0x110): undefined reference to `Client::stop()'
./main.o: In function `setup':
main.cpp:(.text+0x138): undefined reference to `Ethernet'
main.cpp:(.text+0x13a): undefined reference to `Ethernet'
main.cpp:(.text+0x144): undefined reference to `EthernetClass::begin(unsigned char*, unsigned char*)'
main.cpp:(.text+0x14c): undefined reference to `Server::begin()'
I don't know what else to do. Has anyone tried something like this?
I have lost all day trying to figure this out and it turns out its actually not that difficult. The lost time is due a bit to the fact that some settings are "invisible" to the make file. Also the generated eclipse makefiles are quite cryptic for anybody without delving into the manual. If you want to take a look at the manual.To the solution itself:
Short version:
Make a static library project of the Arduino Core library and build it.
Make separate static library project for SPI, w5100 and Ethernet
There are some connections which must be made for the projects to build. First I set the include directories to point correctly, which i will describe next. Second i set the project references correct so its possible to build the application with all the right dependent builds.
SPI -> includes the arduino core
w5100 -> includes arduino core and SPI
Ethernet -> includes arduino core SPI and w5100
The Application itself -> include just w5100 and Ethernet (assuming its just the Ethernet - library)
The Application itself -> add the all paths of your projects to the library paths and the respective libraries(without the lib prefix)
Be careful with project renames as they don't propagate through the library settings and paths. Be mindful also of some sanity in your setup so as to make it easier to catch any detail that is missing and breaking.
I will try to edit later with a more detailed explanation but this should answer your question
EDIT
I have tried to just import the Ethernet folder and make a static project out of if. For some weird reason(i don't know the details of Eclipse) Eclipse doesn't go deeper into the utility folder effectively not compiling it. If it does not compile and, as you dont have a static library for that include files you will get undefined references trying to compile Ethernet. Also static libraries cannot be linked through the avr eclipse plugin, and that should actually be enough. There is no such dialog.
Also in a weird error, which i cannot explain and which drove me almost nuts, some magic in the make file invoked the compiler through the cc variable which Eclipse did not define. The problem was solved passing the variable as an argument to make like make.exe CC=avr-g++.
I tried harder to make it work through only one project and it just ended up giving me undefined references to arduino core in the static library build which got me completely petrified.
I know this is not part of the answer to your question but it shall stay here for anybody to find guidance in the process of making Eclipse a de facto Arduino IDE, which is what you ask.
I don't understand how you got the errors regarding PORTB and DDRB but i think it was probably something missing in the build. As in my case it just spat non sense error reports.
The lesson is: Make the separate libraries into static library projects and reference and include them in source and in static library in your final application.
(Side note: Arduino IDE should be completely banned and migrated to Eclipse or some real IDE)