Including a header file in ESP IDF compiler - c

Im trying to run an example project from esp who, it is under single chip examples, cloned from https://github.com/espressif/esp-who.
Its recognition example. Im including a esp_http_client.h but it cant find it.
There is a CMkakeLists.txt and Makefile.
My first question is, do I have to edit the one of those files to include the header, or I have to add the directory path in the gcc.
If so how do I do that.
Thanks a lot.

You need to specify non-default components as a requirement, in your case esp_http_client. Default components are added by IDF automatically, a list can be found here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html?highlight=default%20component#common-component-requirements
If you can, please use cmake. An explanation how to add a component can be found here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html?highlight=default%20component#component-requirements.
Another easy way would be to look at the esp_http_client example. I uses a "common" component for all idf examples which might be enough for starting: https://github.com/espressif/esp-idf/tree/master/examples/protocols/esp_http_client.
Cheers.

Related

Include problems with FreeRTOS Simple Demo on PIC32MX

I've been trying to get my hands on freeRTOS at work for a few days now.
Since I'm done reading the documentation on the website, I'm now trying to work a simple demo on a PIC32 starter kit (with MPLABX.
So far it works, the led blinks and the messages are sent and received (yeahy).
However, although it doesnt prevent me from running the demo, I get a huge load of red exclamation marks all over the includes and usages of specific types, it's a bit odd.
I've decided not to care too much for the moment.
But now that I'm trying to include a personal header file, I get a failing build.
I have absolutely no idea why this would happen since I've always included header files that same way and never had that kind of problem.
Any help would be really appreciated both on why I can't make that include work and why I got a zillion exclamation marks.
Thanks in advance and please tell me if you need additional informations.
code:
#include "Menu.h"
error:
../main_blinky.c:181:18: fatal error: Menu.h: No such file or directory
EDIT:
I'm done with the zillion exclamation marks pb, I've searched for the missing .h files in the freeRTOS directory and added the paths to the inculde directories option of the compiler.
It looks like you have to add several include folders but I don't remember having read any of that in the documentation probably because it doesn't prevent the demo from running I guess.
Now I need to deal with the other pb. I'll tell you what.
So.. following what I did in edit1, I thought "hey, what if the project's own directory isn't part of the include folders? naaaah can't be... ok let's be sure and give it a try"
And guess what...? it wasn't.
I had no clue this could ever happen but maybe that's just because I'm ignorant to some point.
Anyways, just added the project's path to the include folders path list and now both problems are solved, I hope this will help someone one day or another.

Is there something similar for emacs like vims's NERDtree

For vim there is a filesystem explorer called NERDtree: https://github.com/scrooloose/nerdtree
Surely an alternative or superior package exists for Emacs?
I prefer dirtree (screenshot below) by Ye Wenbin. It feels pretty close to NERDTree / the TextMate drawer.
It took me a few minutes of trial and error to figure out the dependencies, so take a look at the install instructions (and a few minor edits to the source) I've got in this repo.
You can try NeoTree .
https://github.com/jaypei/emacs-neotree
Screenshot:
Have you looked at Speedbar ?
The Sunrise Commander seems to be a well written package, and it has a tree extension. For a screenshot of the tree extension in action, follow this link.
Who needs any tree, when you have the mighty ido-mode . If you can train your mind to find the files, rather than just your eyes whilst visually finding it, you will win. NO need to tell me how biology works, i don't care :-) you get the point.
Personally, I prefer the ECB's tree mode.
http://ecb.sourceforge.net/
You should also check out the CEDET stuff.
http://cedet.sourceforge.net/
They contain a lot of other useful stuff that you can use for similar development needs.
I use a little of emacs-nav and a little of dired to navigate my projects' file trees. For file management tasks, I mostly use bash (often from within emacs).
(Shameless reanswer from A good project tree browser for Emacs? - Stack Overflow)
I just now did a word search for "explore" in package-list-packages, and discovered project-explorer. Seems to fit exactly what I want today (I don't code hardly, but getting a grip on the structure of my Jekyll site).
Keys include TAB for folding and unfolding directories. Open files with RET or f, but with prefix, it will prompt nicely for which window, and even from there allow you to decide to use window or open up a new one to any side (I didn't find the prompt string in the package code, so it seems to leverage built in Emacs functionality nicely; indeed it looks like dired even).
It's available on Melpa and Marmalade, and packaged description points to sabof_project-explorer ยท GitHub.
I include the site's image for convenience:
I don't use projectile or helm, but it has some integration.
Try out lusty-explorer. It's a well done plugin.
Get it here

Inno Setup installer package supplied file list

I've got a "Project" containing a mixed set of files that my application compiles into an installable using InnoSetup. Many of the project files are system or configuration files, and not relevant to the actual install. Therefore, i want to include only the relevant files in an installer. I have a list of them in my application, but no way to inject this information into the template Inno setup script.
What options are available to achieve this?
Regards
Tris
Note: The files are too big to really be copied in a reasonable length of time. :)
sorry for being so late...and then just asking the obvious: why can't you just keep irrelevant files out of the Inno-Script? Do I understand right: you have an app that generates a setup-script for InnoSetup based on a template? Can't you then modify the app? Alternatively, any chance to edit the ISS and remove the irrelevant files?
Cheers
Michael

Setting up Netbeans/Eclipse for Linux Kernel Development

I'm doing some Linux kernel development, and I'm trying to use Netbeans. Despite declared support for Make-based C projects, I cannot create a fully functional Netbeans project. This is despite compiling having Netbeans analyze a kernel binary that was compiled with full debugging information. Problems include:
files are wrongly excluded: Some files are incorrectly greyed out in the project, which means Netbeans does not believe they should be included in the project, when in fact they are compiled into the kernel. The main problem is that Netbeans will miss any definitions that exist in these files, such as data structures and functions, but also miss macro definitions.
cannot find definitions: Pretty self-explanatory - often times, Netbeans cannot find the definition of something. This is partly a result of the above problem.
can't find header files: self-explanatory
I'm wondering if anyone has had success with setting up Netbeans for Linux kernel development, and if so, what settings they used. Ultimately, I'm looking for Netbeans to be able to either parse the Makefile (preferred) or extract the debug information from the binary (less desirable, since this can significantly slow down compilation), and automatically determine which files are actually compiled and which macros are actually defined. Then, based on this, I would like to be able to find the definitions of any data structure, variable, function, etc. and have complete auto-completion.
Let me preface this question with some points:
I'm not interested in solutions involving Vim/Emacs. I know some people like them, but I'm not one of them.
As the title suggest, I would be also happy to know how to set-up Eclipse to do what I need
While I would prefer perfect coverage, something that only misses one in a million definitions is obviously fine
SO's useful "Related Questions" feature has informed me that the following question is related: https://stackoverflow.com/questions/149321/what-ide-would-be-good-for-linux-kernel-driver-development. Upon reading it, the question is more of a comparison between IDE's, whereas I'm looking for how to set-up a particular IDE. Even so, the user Wade Mealing seems to have some expertise in working with Eclipse on this kind of development, so I would certainly appreciate his (and of course all of your) answers.
Cheers
Eclipse seems to be pretty popular for Linux kernel development:
http://cdtdoug.blogspot.com/2008/12/linux-kernel-debugging-with-cdt.html
http://jakob.engbloms.se/archives/338
http://revver.com/video/606464/debugging-the-linux-kernel-using-eclipsecdt-and-qemu/
I previously wrote up an answer. Now I come up with all the details of the solution and would like to share it. Unfortunately stackoverflow does not allow me to edit the previous answer. So I write it up in this new answer.
It involves a few steps.
[1] The first step is to modify linux scripts to leave dep files in. By default after using them in the build, those dep files are removed. Those dep files contains exact dependency information about which other files a C file depends. We need them to create a list of all the files involved in a build. Thus, modify files under linux-x.y.z/scripts to make them not to remove the dep files like this:
linux-3.1.2/scripts
Kbuild.include: echo do_not_rm1 rm -f $(depfile);
Makefile.build: echo do_not_rm2 rm -f $(depfile);
The other steps are detailed in my github code project file https://github.com/minghuascode/Nbk/blob/master/note-nbkparse. Roughly you do:
[2] Configure with your method of configuration, but be sure use "O=" option to build the obj files into a separate directory.
[3] Then use the same "O=" option and "V=1" option to build linux, and save make output into a file.
[4] Run my nbkparse script from the above github project. It does:
[4.1] Read in the make log file, and the dep files. Generate a mirroring command.
[4.2] Run the mirroring command to hard-link the relevant source files into a separate tree, and generate a make-log file for NetBeans to use.
Now create a NetBeans C project using the mirrored source tree and the generated log file. NetBeans should be able to resolve all the kernel symbols. And you will only see the files involved in the build.
The Eclipse wiki has a page about this: HowTo use the CDT to navigate Linux kernel source
I have been doing some embedded linux development. Including kernel module development and have imported the entire linux kernel source code into Eclipse, as a separate project. I have been building the kernel itself outside of Eclipse(so far), but I don't any reason why I shouldn't be able to set up the build environment within Eclipse to build the kernel. For my projects, as long as I setup the PATH properties to point to the appropriate linux source include directories, it seems to be pretty good about name completion for struct fields, etc.
I can't really comment, on if it is picking up the correct defines and not greying out the correspond sections, as I haven't really paid to much attention to the files within the kernel itself.(so far)
I was also wondering about using Netbeans as a linux 'C' IDE, as I do prefer Netbean's for Java GUI development.
I think this would work (done each step for various projects):
[1] Modify kernel build scripts to leave .d files. By default they are removed.
[2] Log the build process to a file.
[3] Write a script to parse the build log.
[3.1] From the build log, you know every .c files.
[3.2] From the .c file, you know which is the corresponding .d file.
[3.3] Look into .d files to find out all the included .h files.
[3.4] Form a complete .c and .h file list.
[4] Now create a new dir, and use "ln -s" or "ln" to pick files of interest.
Now, create a Netbeans project for existing source code in the [4].
Configure code assistance to use make-log file. You should see
exactly the effective source code as when you build it at [2].
Some explanations to the above steps:
At [2], do a real build so the log file contains the exact files and flags of interest.
Later netbeans will be able to use the exact flags to parse.
At [4], pick only the files you want to see. Incorporating the whole kernel tree into netbeans will be unpractical.
There is a trick to parsing .d files: Many of the depended items are not real paths to a .h file, they are a modified entry for part of the linux config sections in the auto config file. You may need to reverse the modification to figure out which is the real header file.
Actually there is a topic on netbeans site. This is the discussion url: http://forums.netbeans.org/ntopic3075.html . And there is a wiki page linked from the discussion: wiki.netbeans.org/CNDLinuxKernel . Basically it asks you to prefix make with CFLAGS="-g3 -gdwarf-2" .
I found this link very helpful in setting up proper indexing in Eclipse. It requires running a script to alter Eclipse environment to match your kernel options, in my case
$ autoconf-to-eclipse.py ./include/generated/autoconf.h .
An illustrated guide to indexing the linux kernel in eclipse

Replacing typelibs for imports

I am working on a project which uses an import
#import "progid:Blah.blah.retrieve" rename_namespace("Blah")
but I would really perfer not to register the dll which is I believe what is missing to allow this to work. I don't want to register the dll because our build system will not be able to build multiple instances at a time. Is there some easy way to convert this import into some other form? I have the source for the progid it is importing.
As you can probably tell I don't understand this #import function very well, does anybody know of a good primer on it?
#import brings in the typelib registered against the prog id you've specified. It does this by looking it up in the registry and following the trail it finds there.
You can also just use #import on the dll directly by filename, and avoid the need to have it registered at all. You can even specify the tlb file directly if you have access to it. See the documentation for the #import directive.
If you need more control on specifying the resource that represents the typelib then there is a relevant knowledge base article.

Resources