I am trying to port a set of files, written for a STM8 microcontroller, to a STM32 microcontroller. But I am not sure how to start.
The firmware on the STM8:
http://www.st.com/web/en/catalog/tools/PF258104
And I want to rewrite it so that it can run on this board: http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF253215?s_searchtype=keyword
There are some sample programs available for the STM32, and I think it's possible. I just need some advise on how to take this on, since there are some controller specific files in the STM8 firmware which need to be rewritten so they can run on the STM32.
Thank you.
Matthijs
Your question is a bit too broad. You should instead dive into trying to convert the code yourself, and ask question about specific details that you do not know how to port over to the new arcitecture, or understand what their original purpose is.
Related
I have been trying to open c files in the Arduino IDE (which some people claim is possible).
I have not been able to do so.
How can I program the Arduino in c given that I have a project/files in another IDE? (for example, MPLABX)
I am not sure what you are trying to archive. Is it that you want to open it via the Arduino IDE or also compile the source code?
I am not aware of programming in bare c in the Arduino IDE. But if you're looking into using real c code, it might be a good time start either compiling and uploading via terminal yourself, or use an IDE which is suited for development with micro controllers.
I think you can tell the Arduino IDE to more elaborately log outputs. This would tell you exactly the commands the IDE is using (uses avrdude). Then you can use an IDE/Editor of your choice for coding.
Otherwise, have a look at eg. Atmel Studio. They also support Arduino.
There are two answers in one:
If you really want to use the ArduinoIDE you have to have a basic *.ino file having at least the defines and includes which are in the project file and the reqiured setup() loop() usually whats in main in c goes to loop() in ArduinoIDE. Thats the stoney path because there are some specific issues coming from the philosophy behind ArduinoIDE (help makers with little (no?) programming skills to get started quickly).
If you just need the Arduino tool-chain and want to work more comfortable you have two other options:
EclipseIDE with the Sloeber add-on. Download the Sloeber-AllInOne-Package for an easy start and THEN add the other modules you need (like for web development or similar)
PlatformIO an IDE for micro controller development - there is also a cloud based version for testing around.
All mentioned tools are real open source and available cross PC platform and not a gift from a company like MS for probably later lockin of devs
I'm using PlatformIO as an IDE for programming AVR MCUs. I'm beginning AVR programming (I have a background in C/C++ and programming on OS's, not embedded, although I have done some Arduino stuff in the past) and using PlatformIO gives me code completion for the registers/pins, which is why I use it.
It seems I can't switch framework from Arduino to avr-gcc in PlatformIO without losing code-completing.
I am wondering if there's any drawbacks in keeping Arduino as the
framework?
I know Arduino uses avr-gcc in the back, but I read that it still does a bit of setup without the users knowing it (such as Timer0 setting for delays, which I need since I'm using it as a clock source for USI on my ATTiny85).
Otherwise, is there anyway in PlatformIO to keep code completion and
use avr-gcc instead of Arduino?
Thanks!
EDIT: I'm on either OSX or linux (ubuntu).
As pointed out by ivankravets on the PlatformIO community platform (see: https://community.platformio.org/t/avr-programming-without-arduino-framework/525/4), it is as simple as removing the line framework = arduino from the platformio.ini file to get rid of the Arduino framework and work in bare C for avr-gcc.
I have never used PlatformIO, and my answer is only based on my (extended) knowledge of AVR development and the Arduino mess…err…framework.
The Arduino framework is using AVR-libc (the standard low level framework that gives you all the tools you need to program on AVR), and adds a layer of abstraction so you're not directly handling registers, but use a more easily understandable interface.
So when you write on a pin, instead of looking at the AVR's IC leg number, looking for the matching PORT address to configure it and mutate it, you're using digitalWrite() on the board's pin number. So, whatever the IC is, the pin will stay the same with consistent capabilities.
The pin definition is done using a header file that's given to the compiler depending on your target setting in your IDE (so whether you use an Arduino Mega or a Leonardo the matching between AVR port/pin and board pinout will change radically).
Given your description of PlatformIO, it's using that information to give you appropriate pinout completion based on the board configuration. It's also certainly taking advantage of the object oriented approach of the Arduino framework, so that you can easily have method completion when using singletons (like when you use Serial).
Using raw AVR-libc, on the other hand, it's harder to get any meaningful completion, because most of the operations are being done on registers which are being declared through preprocessors aliases, and the whole code is pure C, so code completion is not really helpful (you cannot list all the methods that applies to a given object… like with the Serial example).
Then, Arduino offers a nice high level approach to prototyping embedded code, that you can then curate when you need to optimise in time and/or space. And some projects (like the Marlin firmware for repraps) use some sort of hybrid approach, reimplementing many parts of the Arduino interface in a more optimised way (like digitalWrite or the Serial object).
In the end, my advice to you would be to drop platform.io or the arduino IDE, and switch to eclipse if you're really into IDE GUIs, or better, use your preferred powerful editor (like vim/nvim, emacs, atom, sublime…) to have it handle AVR code like any other C code.
If you work on an Arduino project including avr-gcc internals using VisualMicro plugin and VisualStudio (Community Edititon) all the code completion / syntax highlighting / goto declaration etc. works for anything in your project and all libraries.
Is this what you're looking for?
Of course, VisualMicro is annoying if you use them "for free"
I was wondering if anyone knows an efficient way to program the FPGA(PL) for a Xilinx Zynq-7 series or related devices,from a host C program (not on the SoC, but from the host PC). Is there an Xilinx API I can use/include in my program. As the only way I can think of doing it at the moment is invoking command line programming via Impact.
Basically I want to put the SDK "Program FPGA" functionality in my host C program where the user selects a prebuilt .bit file (and .elf file if possible) to program the FPGA/(SoC). This is just for a test of concept, later I would like to put this dynamic configuration onto one of the ARM CPU's.
Many Thanks
Sam
At the very least you'll need an intermediate MPU/MCU that can read from USB, as at startup most FPGAs aren't capable of much at all. I'm guessing this'll make it hard to find a MPU/library pair to do so, because there are so many options, each of which would be pretty application-specific. You're better off starting with programming them off an ARM chip, since you'll need some CPU with the FPGA in any case.
This seems somewhat useful.
I am attempting to connect my Launchpad device to the Pololu MinIMU9v2 9DoF sensor via the I2C bus. I am working in a Linux environment, compiling with arm-none-eabi-gcc, and I have downloaded the sw-ek-tm4c123gxl zip file from the Texas Instruments website.
In digging through the drivers download, I identified a folder (examples/peripherals/i2c) that contains 3 demonstrations (each in a single C file) for using the I2C bus. One runs the Launchpad as a slave, the next configures it as a loopback, and finally, there is one that interfaces the Launchpad with an Atmel I2C-based memory device using what it refers to as "soft I2c".
I'm assuming that the "soft" part of this means that it's software based, utilizing interrupts and all. I'm looking for a simpler solution, preferably without interrupts. The loopback example worked like a charm, for instance, but in modifying it, I can't seem to get it to communicate with the MinIMU9, no matter what I try. The documentation for the MinIMU9 is pretty clear, but I think I'm just lacking an understanding on how to use this driver software.
Finally, I don't want to reinvent the wheel, but I can't seem to find any one else talking about I2C and the stellaris or tivac launchpads. Am I way off the mark in trying to implement this in this way? If not, is there an easier way to go about this? And, if not, where can I learn more about whatever it is that I'm missing?
I was able to figure it out after all. One thing that I hadn't noticed in the first place is that Texas Instruments provides a PDF peripherals resource that discusses the usage of their driver library. Unfortunately, this documentation is far from comprehensive, and probably would have still required someone to bury themselves in the code were it not for the examples.
Now, the peripheral examples required a bit of work to get going. To save some time and effort, I tried copying master_slave_loopback.c over the top of examples/project/project.c, modified it according to the comments within the file, and then I was able to compile the example and run it with immediate success.
Next, I attempted to convert the new project.c file into something that would allow me to communicate with the MiniIMU9v2. Everything seemed straight forward for the most part. I commented out anything that looked like it was related to loopback functionality, but when I would try to execute the program, it would hang on the following line:
while(I2CMasterBusy(I2C0_BASE)) { }
Overwhelmed with what I might have to do to begin troubleshooting this, I decided to post this question. Fortunately, the problem was a lot simpler and surprising to solve than I had suspected. A quick search revealed this page: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/316580.aspx
I changed:
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3);
To:
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
And this solved my problem.
What I need to do is to compile and run a program written in C/C++ on Arduino.
I'm ok with every open source RTOS if it supports C especially struct.
So I have found contikiOS does that, and tried to get started.
But I guess contikiOS doesn't support Arduino port anymore and Due is quite recent model so that I couldn't find proper information.
If you know any information on it or want me to help, please give me an advice.
Ah, do you have any other recommendation for RTOS?
Thanks.
If what you need is to run a simple c/c++ software, you have to know that the arduino environment support c/c++ code, as explained in the arduino homepage http://code.google.com/p/arduino/
If for your requirements, you need to use a real time operating system, there is a contikiOS version for Arduino (Contiki-Arduino).
Last but not least, if you are a beginner, i would advice you to use a popular RTOS, to find support on internet easily if you need it. Sadly, i am not an expert on that field. But when i google it, i find Duinos, maybe you could have a look on it.