2018-10-01 01:20 AM
hello i need to protect my code from reading or just protect the two first pages is enough because ill put my devices on market ?
i cliked on execute only code option in keil flash options
my code doesnt compile here is the error :
..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(254): error: A1944E: Literal pool entries cannot be generated in execute-only sections
..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(272): error: A1944E: Literal pool entries cannot be generated in execute-only sections
..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(405): error: A1944E: Literal pool entries cannot be generated in execute-only sections
what should i do ???
Solved! Go to Solution.
2018-10-03 12:05 AM
in hal config
its opened
#ifdef HAL_FLASH_MODULE_ENABLED
#include "stm32f1xx_hal_flash.h"
i added
#include "stm32f1xx_hal_flash_ex.h"// i add it
it didnt affect still it doesnt detect FLASH_OB_RDP_LevelConfig
2018-10-04 01:39 AM
prblm solved with st link utility
open option bytes
then select enable read out protection then download the new option byte by selecting apply .
then you will see if you try to connect to device it says that cannot read memory ..
2018-10-05 05:39 AM
2019-07-04 09:15 AM
PoVEL A Use this code instead:
FLASH_OBProgramInitTypeDef obInit; /* Allow Access to option bytes sector */
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
obInit.OptionType = OPTIONBYTE_RDP;
obInit.WRPState = OB_RDP_LEVEL_1; // VERY IMPORTANT !! DONT SET TO LEVEL2//MCU FUSE WILL SET FOR EVER.// MCU OR BOARD MAYBE UNUSABLE//
HAL_FLASHEx_OBProgram(&obInit); /* Start the Option Bytes programming process */
//HAL_FLASH_OB_Launch(); /* Prevent Access to option bytes sector */
HAL_FLASH_OB_Lock(); /* Disable the Flash option control register access (recommended to protect the option Bytes against possible unwanted operations)*/
HAL_FLASH_Lock();