You certainly can use PROGMEM (or the newer __flash) on structs in program memory.  But you need to use the right methods to access the data.  Can you post a short sample code that you tried but which did not work?

typedef struct {
        uint16_t int_part;
        uint8_t frac_part;
        float fl_part;
} __attribute__ ((packed)) bw_data;

const bw_data bw_tab[] PROGMEM;

const bw_data bw_tab[] PROGMEM = {
        [BW_7_8] = { //7.81
                .int_part = 7,
                .frac_part = 81,
                .fl_part = 7.81f,
        },
        .... skip ....
    }

float symbols_time_ms(const param_t *const par, const uint8_t symbols_num){
        float temp;
        temp = 1 << (par->sf + 6); //2^SF
temp = (float) temp * (float) symbols_num / bw_tab[par->bw].fl_part;
        return temp;
}

------------------

When I call the function symbols_time_ms (), the result is incorrect if the PROGMEM modifier is uncommented.
Thank you very much for your answer and attention to my question.

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to