Skip to main content
TARHAN SAMAH
Senior
October 1, 2018
Solved

how to protect my code from reading

  • October 1, 2018
  • 13 replies
  • 3687 views

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 ???

This topic has been closed for replies.
Best answer by TARHAN SAMAH

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 ..

13 replies

TARHAN SAMAH
TARHAN SAMAHAuthorBest answer
Senior
October 4, 2018

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 ..

TARHAN SAMAH
Senior
October 5, 2018

there is also this way by code someone told me it thanks mister yilmaz from stm :look at the attached main file here ..good luck

GY_it
Visitor II
July 4, 2019

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();