How to use C Compiler for esp8266 - esp8266

i have been working with platformio for a few weeks now and have been able to create quite a bit for my microcontroller (atmega328p). I have always tried to get away from the Arduino structure. So no “void setup” or “void loop” but simple C.
Now I got a ESP8266, which I would like to compile with a C environment.
When I create the project now (for the 12E) it asks which framework I should use. I have tried them all by replacing the Arduino setup and loop with the int main(){} function, however it always came up with errors. Does anyone know how I can use a pure C environment for the ESP8266?

Related

How to open and read file from outside the OS / non-OS environment (SMM driver)?

I'm running linux and I want to access /proc/kallsyms from outside the OS. I'm writing an SMM driver (EDK2) that's written in C, but I cannot use stdio functions like fopen, because compiler (GCC) says
undefined reference to "fopen"
even though I use #include <stdio.h> and other packages within EDK2 use stdio (go figure \o/)
So I'm wondering is there a way I can access /proc/kallsyms without using functions like fopen or open (which btw I tried to use, same error) ??
It'd need to be "pure C" -ish, if you know what I mean, given that it would not be executed on OS level. Any help or suggestion would be appreciated.

The correct header file to access the cvLoadImage() function

I'm trying to get the algorithm provided in this repository to work on windows. After countless issues, I'm only left with one unrecognized function cvLoadImage which is apprently depricated. I was instructed to work with the c++ API instead but the problem is that I will have to rewrite other parts of the code as well and I might end up breaking it.
#include <opencv2/imgcodecs/imgcodecs_c.h>
returned the below error on Visual Studio:
"This header with legacy C API declarations has been removed from OpenCV. Legacy contants are available from legacy/constants_c.h file."
I imported all files provided in the opencv folder named constants_c.h, but none contained the function definition.
Indeed, that is the old OpenCV C API. You will need to port the old C functions to the c++ OpenCV API, e.g.:
cvNamedWindow -> cv::namedWindow
cvRectangle -> cv::rectangle
cvPoint -> cv::Point
etc.
The code you're using is actually a mix of the old C API and the newer c++ API.
It's just a matter of going through all the C API calls in that repo and manually port them to the c++ API. As you can see above, most of the time that is fairly intuitive. When in doubt search the OpenCV documentation.
Additionally you should look into YOLOv2 for Pedestrian detection.
Update:
There are multiple forks of this repository and it looks like Berak already has already removed the C API calls. His changes were merged, so you should to pull the latest changes and rebuild:
cd C4-Real-time-pedestrian-detection
git pull
cmake . -DCMAKE_CXX_FLAGS="-std=c++11"
make -j8
I've tested the above on my machine:
Regarding my setup, I ran into this error first:
cvdef.h:656:4: error: "OpenCV 4.x+ requires enabled C++11 support"
which is why I've passed the -std=c++11 compiler flag to cmake.
This may be because I'm an older version of OSX (10.11.6) with Xcode 7.0 (about 3 years old now). The current machine has 8 cores, hence make -j8.
Feel free to change these two options as necessary on your machine.

Port game from iOS (iPad) to Windows

Is it possible to to port a game, originally built for iOS (iPad version only, but it's not important) to Windows in an easy manner?
I assume I have all the source code of the original game. I also have experience with Obj C as well as with C#.
If not, what would be the steps for this kind of sorcery? Where could I find appropriate tutorials or references? Or anything.
When I did it, it was from the ground up. I was able to use my objective c classes as guides, but I still had to write it line by line (nothing automatic).
There is, however, a good introduction to the differences from an iOS developer's perspective over on Jesse Liberty's site that I found helpful: http://jesseliberty.com/2010/08/23/i2w-an-iphone-developers-guide-to-creating-windows-phone-7-applications-tutorial/

Functions from MATLAB to XCode

Essentially what I'm trying to do, is turn the following function:
function [template, mask] = createiristemplate(eyeimage_filename)
into a form useable by Xcode. I've spent several hours poring over the internet, and have yet to find a clean way to make it work. Any help would be greatly appreciated.
If you are talking about Xcode, the mac IDE: https://en.wikipedia.org/wiki/Xcode
According to wikipedia, this software can support the following languages:
C, C++, Objective-C, Objective-C++, Java, AppleScript, Python and Ruby
So the only way, is to use matlab coder, it is a matlab tool to convert matlab code in C or C++ :
http://www.mathworks.fr/products/matlab-coder/index.html
But it is an expansive toolbox.

OpenCV on Erlang

I would like to use OpenCV in my Erlang application. One solution would be to write an Erlang port etc., but I'm sure it has been done before.
The ideal result would be to be able to configure OpenCV from Erlang, and never touch a line of C code. But is this possible ? How would you do that ?
Why not wrap the specific OpenCV configuration in a C application using the OpenCV C lib and call that app using Result = os:cmd('myapp'). That way you don't have to mess around with possible interoperability issues and have a clear separation between you C and Erlang code.

Resources