embedded

Arm: How does objcopy know which sections from an elf to include in a binary or ihex?

情到浓时终转凉″ 提交于 2019-12-09 22:49:12
问题 I'm working on a project which involves parsing an arm elf file and extracting the sections from it. There are obviously plenty of sections in an elf file which do not get loaded into flash, but I'm wondering how exactly objcopy knows which sections to include in a binary to be flashed directly into flash? Take for example the following readelf of an arm elf file: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .isr_vector PROGBITS

When do I use xdata?

感情迁移 提交于 2019-12-09 16:49:30
问题 I am new at embedded system programming. I am working on a device that uses an 8051 chipset. I have noticed in the sample programs that when defining variables, sometimes they use the keyword xdata. like this... static unsigned char xdata PatternSize; while other times the xdata keyword is omitted. My understanding is that the xdata keyword instructs the compiler that that variable is to be stored in external, flash, memory. In what cases should I store variables externally with xdata?

Best practice on writing constant parameters for embedded systems

痴心易碎 提交于 2019-12-09 16:00:19
问题 This is a case of "static const” vs “#define” in C" for embedded systems. On large/mid projects with "passed-down" code and modules, what is the best practice on writing constant parameters for your include files, modules, etc? In a code "passed-down" where you don't know if the names you're choosing are defined in some other included file or might be called with extern or as macros in some other file that might include your file. Having these 3 options: static const int char_height = 12;

Does “static/extern uint8_t array[2] = {0};” conform to the ANSI C specification?

跟風遠走 提交于 2019-12-09 15:53:33
问题 I've a question regarding the following code: #include "all_needed.h" static uint8_t array[2] = {0}; void main(void) { ... } Is a (module) global array allowed to be initialized as above for having each member set to zero while being ANSI C conform? I've got a problem in Code Composer 5 (MSP430 Project) where I had to change it into static uint8_t array[2] = {0, 0}; for a correct initialization of the 2nd member of the array. 回答1: Yes, this is allowed, and should initialize the array to zero.

memory leak debug

家住魔仙堡 提交于 2019-12-09 11:56:29
问题 What are some techniques in detecting/debugging memory leak if you don't have trace tools? 回答1: 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

-Werror causes compiler to stop on #warning. What can I do to prevent this?

吃可爱长大的小学妹 提交于 2019-12-09 11:13:38
问题 First off, I want it to stop on warnings. But I also want to print out some informative messages (like "Come back and implement this!"). Unfortunately, my compiler doesn't support #info , #message , #pragma message() , etc. I know there's -Wno-error=<something> , but my google-foo is weak, and I can't seem to find out the <something> for #warning . I've tried -Wno-error=warning , and that just says "there's no -Wwarning ". Same with " warn ". Any suggestions? For what its worth, I'm using the

Prototyping and simulating embedded software on Windows

落爺英雄遲暮 提交于 2019-12-09 11:08:37
问题 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

Finding latency issues (stalls) in embedded Linux systems

馋奶兔 提交于 2019-12-09 10:53:30
问题 I have an embedded Linux system running on an Atmel AT91SAM9260EK board on which I have two processes running at real-time priority. A manager process periodically "pings" a worker process using POSIX message queues to check the health of the worker process. Usually the round-trip ping takes about 1ms, but very occasionally it takes much longer - about 800ms . There are no other processes that run at a higher priority. It appears the stall may be related to logging (syslog). If I stop logging

What is Qt Bare Metal?

会有一股神秘感。 提交于 2019-12-09 10:13:58
问题 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? 回答1: 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

Undefined reference to 'operator delete(void*)'

a 夏天 提交于 2019-12-09 08:21:35
问题 I'm new to C++ programming, but have been working in C and Java for a long time. I'm trying to do an interface-like hierarchy in some serial protocol I'm working on, and keep getting the error: Undefined reference to 'operator delete(void*)' The (simplified) code follows below: PacketWriter.h: class PacketWriter { public: virtual ~PacketWriter() {} virtual uint8_t nextByte() = 0; } StringWriter.h: class StringWriter : public PacketWriter { public: StringWriter(const char* message); virtual