Open wanghuayuan0 opened 8 years ago
Hello! Sorry I don't quite understand your question, would you mind clarifying? Thanks!
Hi, Tony,
Sorry for my poor english and unclear description T^T.
I mean, the FLASH_BLOCK_SIZE
is 32:
#ifndef EDDYSTONE_FLASH_H
#define EDDYSTONE_FLASH_H
#include <stdint.h>
#include <stdbool.h>
#include "ble_ecs.h"
#include "pstorage.h"
#include "eddystone_app_config.h"
#define FLASH_BLOCK_SIZE 32 //Minimum size 32, for ECDH key storage
and the size of eddystone_flash_flags_t
is 8
typedef struct
{
bool factory_state; //If this flag is true, then use factory default frame configs
bool slot_is_empty[APP_MAX_ADV_SLOTS];
uint8_t padding[ WORD_SIZE - ((APP_MAX_ADV_SLOTS+1) % WORD_SIZE) ]; //Add padding up to the next multiple of WORD_SIZE
} eddystone_flash_flags_t; //TODO: talk about having the flags struct match flash block size here
you don't match the flags struct to flash block size this version.
when calling this code snippet
case EDDYSTONE_FLASH_ACCESS_READ:
err_code = pstorage_load((uint8_t*)p_flags,
&flags_handle,
FLASH_BLOCK_SIZE,
0);
RETURN_IF_ERROR(err_code);
break;
32 bytes data in flash will load to point p_flags
, but there are only 8 bytes expected , the unnecessary 24 bytes may overwrite something in ram and cause hardfault
..
I tested this SDK on 52DK, it performed will, but it caused hardfault
on 51DK
Thanks
Hi tony, I think I found a little problem of function
eddystone_flash_access_flags
when I using this SDK at nrf51422The size of
eddystone_flash_flags_t
is 8, and loading size is FLASH_BLOCK_SIZE(32). It will damage other data in ram