30 years of experience writing embedded, real-time software.

Re: Determining the index of a value in a struct

Reply posted 2 months ago (08/05/2021)
I don't really know what you're asking for but maybe offsetof() can help you?#include <stddef.h> ... size_t const index = offsetof(union Setings, str.TimeFormat);...

Re: Why CRC with EPROM?

Reply posted 4 months ago (06/25/2021)
You bet. Be sure to specify a C ISO standard, e.g. "C11" and then stick to it. Don't go back to the dark pre-C99 days.

Re: Why CRC with EPROM?

Reply posted 4 months ago (06/25/2021)
It's not that EEPROM is unreliable it's that you cannot guarantee that your writes will be coherent WRT the data structures you are writing out to the EEPROM. If...

Re: Questions re Coding Efficiency

Reply posted 7 months ago (03/30/2021)
Then I recommend you try using https://godbolt.org/ and watching what if-else vs switch vs function pointers yields for your chosen compiler and optimization flags.And...

Re: Questions re Coding Efficiency

Reply posted 7 months ago (03/30/2021)
I'd say don't worry about optimizing until you need to worry about optimizing. When you are out of code or data space then you need to worry about getting small....

Re: Cache memory vs volatile

Reply posted 7 months ago (03/19/2021)
Yes, sorry about that. I agree about just using volatile and being safe. My second case I should have looked like this:static bool s_data_ready; static void isr(void)...

Re: Cache memory vs volatile

Reply posted 7 months ago (03/19/2021)
Matt to your point about the ISR/background volatile. I always declare shared vars between ISR and background code volatile but some colleagues have said that's...

Re: Cache memory vs volatile

Reply posted 7 months ago (03/19/2021)
It's probably worth reading https://en.cppreference.com/w/c/language/volatile to understand volatile a bit more. My rule on volatile is if the compiler cannot detect...

Re: Skillsets from 8-bit, 16-bit, 32-bit

Reply posted 10 months ago (12/21/2020)
I'm not sure that's wholly accurate. You can get a 32-bit Cortex-M0+ pretty cheap. Given a similar price point for an 8- or 16-bit MCU vs. an ARM M0+ I'd go ARM...

Use this form to contact mrfirmware

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address