embedded

How can you do C++ when your embedded compiler doesn't have operator new or STL support?

三世轮回 提交于 2019-12-03 14:45:41
I am working on a group senior project for my university and I have run into a major hurdle in trying to get my code to work. The compiler that we have for our 8 bit Atmel microcontroller does not support the new or delete operators, and it does not support the C++ STL. I could program it in C, but I have to implement an A* algorithm which I have never done before. While I have tried C initially I soon realized that I never did pure C before. Trying to model objects with structs and functions is slowing me down since I am so used to the much cleaner C++ syntax. Regardless, the exact wording

memory leak debug

一世执手 提交于 2019-12-03 14:24:16
What are some techniques in detecting/debugging memory leak if you don't have trace tools? Intercept all functions that allocate and deallocate memory (depending on the platform, the list may look like: malloc, calloc, realloc, strdup, getcwd, free), and in addition to performing what these functions originally do, save information about the calls somewhere, in a dynamically growing global array probably, protected by synchronization primitives for multithreaded programs. This information may include function name, amount of memory requested, address of the successfully allocated block, stack

Does Linux malloc() behave differently on ARM vs x86?

懵懂的女人 提交于 2019-12-03 14:09:07
问题 There are a lot of questions about memory allocation on this site, but I couldn't find one that specifically addresses my concern. This question seems closest, and it led me to this article, so... I compared the behavior of the three demo programs it contains on a (virtual) desktop x86 Linux system and an ARM-based system. My findings are detailed here, but the quick summary is: on my desktop system, the demo3 program from the article seems to show that malloc() always lies about the amount

What is Qt Bare Metal?

五迷三道 提交于 2019-12-03 14:08:48
QtCreator has a plugin named "Bare Metal". Bare Metal means a computer without an operating system. I have not seen much about Qt Bare Metal development. Is it a way to develop Qt for a bare metal system? Does Qt run on a system with no OS? If yes, what are the advantages of this approach for embedded system development? Is it a way to develop Qt for a bare metal system? No. Does Qt run on a system with no OS? No. Bare Metal means you usually have a few KB of RAM and ROM. I think you are confusing Qt (framework) with QtCreator (IDE). Tim Sander explains it clearly here at the Qt Developer Days

Strip unused runtime functions which bloat executable (GCC)

泪湿孤枕 提交于 2019-12-03 14:02:40
I have build the GCC4.7.1 cross-toolchain for ARM (cortex-m3). Now I'm linking an executable from C/C++ code that surely doesn't use some certain STL classes (e.g. std::string ). Furthermore exceptions and RTTI are turned off. Though when I'm looking to the target ELF (e.g. using nm), there's a lot of symbols (apparantly from the libstdc++) linked in I wouldn't expect to find there (e.g. std::exception , std::ios_base , etc.). Why is this there, and how can I get rid of this stuff to reduce the .text section size of my target? A coworker gave me a tip to override some GCC specific stub

How to do code coverage on embedded

∥☆過路亽.° 提交于 2019-12-03 14:02:19
问题 I write a project for a non POSIX embedded system so I cannot use gcc option --coverage (i don't have read or write). What else can I do to produce gcov like output. I do have an output function. 回答1: It can be most easily done with by a processor with embedded trace, a board design that exposes the trace port, and a suitable hardware debugger and associate software. For example, many Cortex-M based devices include ARM's embedded trace macrocell (ETM), and this is supported by Keil's uVision

Prototyping and simulating embedded software on Windows

本秂侑毒 提交于 2019-12-03 13:55:30
I am looking for tools and techniques for prototyping (virtual prototyping), simulation, and testing of deeply embedded C code on desktop Windows, including building realistic embedded front panels consisting of buttons, LEDs, and LCD displays (both segmented and graphic). I'm specifically interested in a possibly low-level approach, using pure C code and raw Win32 API rather than MFC, .NET/C#, vxWidgets or Qt. I'd also like to use free development tools, such as Visual C++ Express with Platform SDK and ResEdit for editing resources. I'm looking for code examples to render graphic LCDs (from

how to schedule two tasks?

霸气de小男生 提交于 2019-12-03 13:07:55
I am novice in process/task management. I would like to schedule two tasks. suppose, fun1() { printf("It will be printed in every 1 min \n"); } fun2() { printf("It will be printed in every 2 min \n"); } main() { fun1(); fun2(); } So how to schedule them, so that I will get my desired output. I want it to run in Code::Blocks (Windows). I want fun1 to run 1 min and fun2 to run every 2 mins. If I can do it in two separate process also then tell me how can I do it. Do I need to use semaphore, mutex and all? Your example is trivial and can be scheduled without resorting to any OS provided

How to illustrate an interrupt-driven process?

好久不见. 提交于 2019-12-03 12:42:15
This question is related to diagraming a software process. As an electrical engineer, much of the software I do is for embedded micro-controllers. In school, we learned to illustrate our algorithm using a flowchart. However, nowadays, many of my embedded projects are heavily interrupt-driven where the main process runs some basic algorithm a variety of interrupt sources provide its stimulus. So, my question is, what are some diagramming techniques that I can use to illustrate my process such that future developers can understand what I am doing easily and get involved in development? Here are

ELF file headers

纵饮孤独 提交于 2019-12-03 12:25:56
问题 A quick question about elf file headers, I can't seem to find anything useful on how to add/change fields in the elf header. I'd like to be able to change the magic numbers and to add a build date to the header, and probably a few other things. As I understand it the linker creates the header information, but I don't see anything in the LD script that refers to it (though i'm new to ld scripts). I'm using gcc and building for ARM. thanks! Updates: ok maybe my first question should be: is it