embedded

How to interpret binary data in C++?

I am sending and receiving binary data to/from a device in packets (64 byte). The data has a specific format, parts of which vary with different request / response. Now I am designing an interpreter for the received data. Simply reading the data by positions is OK, but doesn't look that cool when I have a dozen different response forma...

How do I get Eclipse to find and use a gcc based toolchain in a non-standard location

Hi, I am trying to get Eclipse to work with a GCC based ARM cross compiler. How can I configure eclipse to add the new tool chain to its list of tool chains? The tool chain is a Raisonance distributed GCC tool chain: C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe ...

C++ namespace problem with ARM RealViewICE

I'm using ARM RealView debug 3.1 and I'm unable to watch variables inside functions defined in a C++ namespace, the code works well and is compiled with armcc. Do any of you know a solution for this? ...

Selecting a Unique Identifier in C for an Embedded Application

I am currently trying to implement an algorithm to select a unique (16-bit) identifier. The challenge is to do this in an fast way that doesn't use too much memory. The list of currently used identifiers is determined through scanning an external Flash device via a sequence of SPI transactions and is therefore a relatively slow process...

Compiling C++ using -pthreads for Openwrt Linux-Get segmentation fault

Hi. I´m pretty new to programming in C++ and I´m using pthreads. I´m cross compiling my code for OpenWRT but for some reason I get segmentation fault when I run the program on my board but it runs fine on my PC. I suspect that the error occurs in the linking stage of the compilation because I tried a small C program and that worked fine...

Why are global variables bad, in a single threaded, non-os, embedded application

Most of the objections I see to using global variables make sense since they refer to issues of multiple threads, thread safety, etc. But in a small, single threaded, non-OS, case, what objections do you have? In my case, I'm writing my embedded system in "C", if it matters. I'm also the only developer on the product. Why would elimin...

Are the Stack Overflow Dev Days relevant to embedded software engineers?

It's the nature of Stack Overflow, its blog and the Dev Days that a lot of their content is geared towards topics that appear of limited relevance to embedded software engineers. That said, I'm a big fan of SO, as topics seemingly unrelated to our work can be very interesting - and it does still provide a forum to discuss embedded-relat...

Writing PSRAM in EZ Flash 3 in 1

I am trying to figure out how to program the PSRAM in the GBA sized EZ Flash 3 in 1 card. Basically repeat what GBA Exploader and other programs do. If I select a block and program it then read it back the first halfword is always 0x1500 or something like that, but the rest of the data is fine. If on the write I select the previous ...

What are techniques for allowing safe software upgrades in embedded systems

Upgrading software for embedded devices often has the possibility of "bricking" the device, e.g. if power should happen to fail while in the midst of writing software to FLASH. Two questions: What are some best practices for implementing the upgrade mechanism so as to minimize the probability that the device will be "bricked"? What are...

Using C++ in an embedded environment

Today I got into a very interesting conversation with a coworker, of which one subject got me thinking and googling this evening. Using C++ (as opposed to C) in an embedded environment. Looking around, there seems to be some good trades for and against the features C++ provides, but others Meyers clearly support it. So, I was wondering w...

Embedded Cellphone Code

What do most cellphones use to run the hardware? C? I'm just talking about the "common cellphone", not smart phone/android stuff. ...

Keeping time using timer interrupts an embedded microcontroller

Hello, This question is about programming small microcontrollers without an OS. In particular, I'm interested in PICs at the moment, but the question is general. I've seen several times the following pattern for keeping time: Timer interrupt code (say the timer fires every second): ... if (sec_counter > 0) sec_counter--; ... Main...

Convert ADC Bins into Voltage

Let's say I have a 12-bit Analog to Digital Converter (4096 bins). And let's say I have a signal from 0 to 5 Volts. What is the proper conversion formula to convert ADC bins into Volts? V = ADC / 4096 * 5 or V = ADC / 4095 * 5 Do I divide by 4096 because there are 4096 bins in the ADC? Or do I divide by 4095 because that is the h...

C++: optimizing member variable order?

I was reading a blog post by a game coder for Introversion and he is busily trying to squeeze every CPU tick he can out of the code. One trick he mentions off-hand is to "re-order the member variables of a class into most used and least used." I'm not familiar with C++, nor with how it compiles, but I was wondering if This sta...

Can I program an ingenico/verifone terminal to do whatever I want?

Ideally, I would connect an ingenico/verifone terminal to the net via an ethernet cable, the terminal will run exclusively a program that I wrote. This program would poll a webservice, beep when it detects some kind of info, wait for somebodys input, transmit said info back to the webservice and print a ticket. Is this possible with ter...

C++ for 8051 microcontroller?

Hi all, Could someone please tell me if it's possible to burn an 8051 microcontroller with a C++ program? I've tried searching about it online but can't seem to find out for sure if it's possible or not. Keil uses C, but the program I need to write is very string-intensive and C is quite string-unfriendly as compared to C# which is wha...

Do you think you need some simple tutorials on Microcontroller programming?

This is not 100% programming related. But I think this is somewhat useful because it is addressing a minority in the SO community. Microcontroller programming is one of the interesting areas in programming. I saw some topic here requesting the Resources for starting / learning / discussing about PICs. Example topic Since I have plenty...

What did you develop using a microcontroller?

I've always been fascinated by microcontrollers and I'm planning to do a few hobby projects just to satisfy my inner geek :) I'm looking for ideas and motivation, so what did you develop using a microcontroller? If possible please state the microcontroller and/or development environment and an estimate on hardware costs beyond the basi...

Linker error while building a edb database

error LNK2019: unresolved external symbol _CeCreateDatabaseWithProps referenced in function "public: __thiscall EDB::EDB(void)" (??0EDB@@QAE@XZ) I got the following linker error in the .obj file of my project. I have coredll.lib and Windbase_edb.h Windbase.h winbase.h included in the project covering the dependancies as instructed i...

Using floats with sprintf() in embedded C

Guys, I want to know if float variables can be used in sprintf() function. Like, if we write: sprintf(str,"adc_read = %d \n",adc_read); where adc_read is an integer variable, it will store the string "adc_read = 1023 \n" in str (assuming that adc_read = 1023) How can I use a float variable in place of integer? ...