embedded

Using printf with two UARTs

情到浓时终转凉″ 提交于 2019-12-05 07:57:14
I have implemented fputc and fgetc in retarget.c to successfully use printf via UART0 on a Cortex-M3. However, I want a second uart channel for additional debug information. How can I integrate this as nicely as I can UART0 using printf? For example, using fprintf to a custom target and checking in fputc which target to send the character to.. E.g. for normal output fprintf(UART0,".."); and for debug output fprintf(UART1,".."); But I cannot see if fopen is called for stdout so I am struggling to see how to manually implement this. (If I just call fprintf(RANDOM_VALUE,..) , I don't know how

Declaring a pointer to const or a const pointer to const as a formal parameter

北城余情 提交于 2019-12-05 07:52:16
I was recently making some adjustments to code wherein I had to change a formal parameter in a function. Originally, the parameter was similar to the following (note, the structure was typedef'd earlier): static MySpecialStructure my_special_structure; static unsigned char char_being_passed; // Passed to function elsewhere. static MySpecialStructure * p_my_special_structure; // Passed to function elsewhere. int myFunction (MySpecialStructure * p_structure, unsigned char useful_char) { ... } The change was made because I could define and initialize my_special_structure before compile time and

Building a two-part firmware image using GCC toolchain

梦想与她 提交于 2019-12-05 07:21:39
I have some firmware built with GCC that runs on an ARM Cortex M0 based microcontroller. The build currently generates a single binary image that can be written into the program memory of the microcontroller. For reasons to do with field update, I need to split this image into two parts that can be updated separately. I'll call these Core and App . Core : contains the interrupt vector table, main() routine, and various drivers and library routines. It will be located in the first half of the program memory. App : contains application-specific code. It will be located in the second half of the

How to detect cold boot versus warm boot on an ARM processor?

て烟熏妆下的殇ゞ 提交于 2019-12-05 06:56:28
I'm looking for a way to determine whether an ARM processor is booting from a cold boot (i.e. initial power-on) versus a warm boot (i.e. reset assertion without actual power loss). Specifically I'm using an ARM968 core, will be making the determination using C or assembly, and I will use the determination so certain operations only run on the initial power-on and not on subsequent resets. In previous projects I've leveraged external circuitry (e.g. FPGA) to detect the different boot scenarios, but in this case I am limited to the ARM core. You can initialize a global variable in RAM to a value

Which Cortex-M3 interrupts can I use for general purpose work?

南笙酒味 提交于 2019-12-05 05:30:34
I'd have some code that needs to be run as the result of a particular interrupt going off. I don't want to execute it in the context of the interrupt itself but I also don't want it to execute in thread mode. I would like to run it at a priority that's lower than the high level interrupt that precipitated its running but also a priority that higher than thread level (and some other interrupts as well). I think I need to use one of the other interrupt handlers. Which ones are the best to use and what the best way to invoke them? At the moment I'm planning on just using the interrupt handlers

Small RISC emulator

穿精又带淫゛_ 提交于 2019-12-05 04:47:17
问题 I'm looking to build a VM into a game and was wondering if anyone knew of any really simple VM's (I was thinking RISC/PIC was close to what I wanted) that are usually used for embedded projects such as controlling robots, motors, sensors, etc. My main concern is having to write a compiler/assembler if I roll my own. I'd be nice to use the tools that are already out there or in its simplest form just a C compiler that can compile for it :-p. I really don't want to re-invent the wheel here but

How to debug random data abort issue on arm based platform

a 夏天 提交于 2019-12-05 04:12:08
问题 As developing on ARM based project, we get data abort randomly, that is when we play with it we get a data abort interrupt. But the data abort is not always on the same point when we check with the register map with r14 or r13, even though check the function callback. Is there anyway that I can get the information about the root cause on data abort precisely? I have try the ref2 but could not get the same point when I trap the data about interrupt. Related ARM Data Abort error exception

Can I install .NET Framework 4 on Windows XP Embedded?

旧时模样 提交于 2019-12-05 03:44:14
I can't test it but I need to know if it real , because I started working on project for it with .NET 4 so I must to be sure I can install it there. So can I install .NET Framework 4 on Windows XP Embedded ? Thank you. Based on the wiki entry for Windows XP Embedded : Windows XP Embedded, commonly abbreviated "XPe", is a componentized version of the Professional edition of Windows XP. So I'd say yes, because .NET Framework 4 is compatible with Windows XP Professional. .NET 4.0 Framework Template available Microsoft has published a Windows XP Embedded template for the Microsoft .NET Framework 4

Compute logarithmic expression without floating point arithmetics or log

安稳与你 提交于 2019-12-05 02:54:22
问题 I need to compute the mathematical expression floor(ln(u)/ln(1-p)) for 0 < u < 1 and 0 < p < 1 in C on an embedded processor with no floating point arithmetics and no ln function. The result is a positive integer. I know about the limit cases (p=0), I'll deal with them later... I imagine that the solution involves having u and p range over 0..UINT16_MAX , and appeal to a lookup table for the logarithm, but I cannot figure out how exactly: what does the lookup table map to? The result needs

Measure static memory usage for C++ ported to embedded platform

自古美人都是妖i 提交于 2019-12-05 02:45:21
I have created a small program as a proof-of-concept for a system which are to be implemented on an embedded platform. The program is written in C++11 with use of std and compiled to run on a laptop. The final program which should be implemented later is an embedded system. We do not have access to the compiler of the embedded platform. I would like to know if there is a way to determine a programs static memory (the size of the compiled binaries) in a sensible and comparable way when it should be ported to an embedded platform. The requirement is that the size of the binary is less than 10kb.