2011-03-30 06:48 AM
COSMIC and OPTION_BYTE
2011-05-17 06:12 AM
A solution can be to embedd C source code for option byte programming at the beginning of your project:
/* Define FLASH programming time */
FLASH_SetProgrammingTime(FLASH_PROGRAMTIME_STANDARD);/* Unlock Data memory */
FLASH_Unlock(FLASH_MEMTYPE_DATA);/* Program value and complement value at adress and address + 1 */
FLASH_ProgramByte((add), val); val_comp = (u8)(~val); FLASH_ProgramByte((add + 1), val_comp);brazov2
Hello all !
I'm trying to preinit my MCU's OPTION_BYTE to create a binary with the OPTION_BYTE allready set ! This work fine with a assembly file in Ride7 with raisonnance compiler, but now i'm trying to do the same thing with ST Visual Develop and Cosmic compiler but I don't work ! Of course a find pseudo-solution, but I want a solution without modifying the linker command file (this isn't a profesionnal solution !) I don't agree with the other solution trough STVP, because my code will be shared I prefer something in a assembly file or C source to avoid mistake instead of a extra manipulation ! And I prefer something who work in debug mode too ! Please help me !2011-05-17 06:12 AM
typo error: instead of FLASH_ProgramByte use FLASH_ProgramOptionByte
brazov2From: brazov.ajejePosted: Thursday, March 31, 2011 11:39 AMSubject: COSMIC and OPTION_BYTEA solution can be to embedd C source code for option byte programming at the beginning of your project:
/* Define FLASH programming time */
FLASH_SetProgrammingTime(FLASH_PROGRAMTIME_STANDARD);/* Unlock Data memory */
FLASH_Unlock(FLASH_MEMTYPE_DATA);/* Program value and complement value at adress and address + 1 */
FLASH_ProgramByte((add), val); val_comp = (u8)(~val); FLASH_ProgramByte((add + 1), val_comp);brazov2
2011-05-17 06:12 AM
Thanks but I found by myself what i'm looking for !
Here is my code : #pragma section const {OptionByte} const struct OPT_struct OPTION_BYTE = {0x00, 0x00, 0xFF, 0x02, 0xFD, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF}; #pragma section () You need to add this new section in your lkf file, forget hand modification, goto Project -> Settings -> Linker -> Category : Input Add a Segment and add a sub section, enter address of start and end. Set the option of the section to -k to avoid linker optimisation, the linker will keep this unused section. The final binary fille will include the OPTION_BYTE set according to your need !