Quantcast
Channel: User Dan - Stack Overflow
Browsing all 37 articles
Browse latest View live

Comment by Dan on C design pattern performing a list of actions without...

Sure thing, no problem. Usually the answer is either "threads" or "state machines", or even both together (for some reason, many people consider multithreading and statemachines to be incompatible /...

View Article



Comment by Dan on Detect when multiple enum items map to same value

Thanks, this is quite clever and your example was very helpful. I have to move between C and C++ (embedded systems development) so this approach is quite useful. Thank you!

View Article

Comment by Dan on Operational modes and Access levels in arm cortex

There are privilege levels (privileged, unprivileged) and modes (thread, handler). Once you're running unprivileged, typically the way you switch to privileged mode is through a "software interrupt",...

View Article

Comment by Dan on Craking long RSA keys from public key only

@orangecaterpillar's answer is good. A couple other things to keep in mind... don't bother trying odd numbers ending in 5, by definition (except for '5') they won't be prime. Also, if this is for a...

View Article

Comment by Dan on Use timer A0 to blink the onboard LEDs connected to pins...

Is this the MSP430F5529 Launchpad board or a different board? My 5529 Launchpad has the LEDs on P1.2 (TA0.1) and P1.3 (TA0.2), not P1.0 and P4.7. Also what is the input clock frequency to TA0? I...

View Article


Comment by Dan on How to use the watchdog timer in a RTOS?

@iheanyi -- your first comment -- yes, what I meant is that I tend to write code that blocks in 1 place -- at the top of the task loop -- and not block in other places (e.g. 3 levels deep of function...

View Article

Comment by Dan on CMake with an embedded C compiler that doesn't support "-o"

@CraigEstey - your suggestion is a good one, but I suspect OP will come back and say that the compiler vendor is either no longer in business, or not supporting/updating the compiler anymore. (The HC12...

View Article

Comment by Dan on Ordering of registers in PUSH and POP brackets

"So r0 is bit 0, r1 is bit 1 and so on. So the 7 in b407 indicates the three registers r0,r1,r2. The logic operates on machine code not assembly language, the machine code goes from bit 0 to bit 7 if...

View Article


Answer by Dan for C - Architecture independent function call interposition

Can you use a function-like macro to implement "do something" in the context of the calling function, and then do a normal call to the function pointer? (Yes, standard disclaimers about macros, esp....

View Article


Answer by Dan for C++ exception overhead

Just my 2 cents...I consult exclusively on embedded systems, most of them hard real-time and/or safety/life critical. Most of them run in 256K of flash/ROM or less - in other words, these are...

View Article

Answer by Dan for Should one avoid using recursive call in C/C++?

The call stack in C & C++ is kind of like the vtable in C++in one respect - it's not mentioned in the standard as far as I know, i.e., that implementation is not mandated, but for all practical...

View Article

Answer by Dan for What is the fastest way to transpose the bits in an 8x8...

This code is cribbed directly from "Hacker's Delight" - Figure 7-2 Transposing an 8x8-bit matrix, I take no credit for it:void transpose8(unsigned char A[8], int m, int n, unsigned char B[8]) {...

View Article

Answer by Dan for Can you link a C++ library from a C application?

The answer to your question is "yes" but as others have pointed out, there are some considerations, hazards & limitations to what you can do & how you do it.Just recently in the course of...

View Article


Answer by Dan for Prevent malloc/free to be compiled for embedded projects

Included in the Keil installation is a set of PDFs... one of the documents (document ID DUI0475A) is titled "Using ARM C and C++ Libraries and Floating-Point Support". It discusses use of the heap (and...

View Article

Answer by Dan for What is the purpose of putting an immediate value in parens...

Actually, those are parentheses, not brackets.There is no difference between:subs r2, r2, #(32)andsubs r2, r2, #32I suspect the (32) used to be something like (32 - 8) or something that was interesting...

View Article


Answer by Dan for itte in arm assembly

It is the ARM's IF-THEN-ELSE instruction, which was introduced in the Thumb-2 instruction set. (Based on your specific example above, it would have been helpful if you had shown the next 3 instructions...

View Article

Answer by Dan for LPC17xx: Check if RTC is running

I battled with the RTC on that chip's grandfather (LPC2148) about 5 years ago. If you look on the Yahoo LPC2000 group (it also covers the LPC1000 chips) you'll see the RTC & its issues come up a...

View Article


Answer by Dan for When is an integerpointer cast actually correct?

It's very common in embedded systems to access memory-mapped hardware devices where the registers are at fixed addresses in the memory map. I often model hardware differently in C vs. C++ (with C++ you...

View Article

Answer by Dan for How to save value of the user stack pointer into variable...

I think I might have answered a similar question here: "ARM - access R13 and R14 from Supervisor Mode"In your case, just use "IRQ mode" instead of "Supervisor mode", but I think the same principle...

View Article

Answer by Dan for How do I set a VxWorks breakpoint on a C static function?

Assuming the routine really exists as you'd expect (i.e., not optimized away or inlined) - I've used a couple approaches in situations like this:Assembly breakpointlet's say you want to set a...

View Article
Browsing all 37 articles
Browse latest View live




Latest Images