2018-01-11 11:22 PM
I have two executive files which there is a little difference between both files.
I want to distinguish two files by inserting a number in the specific place of the executive file.
Is it possible? If then, How can I do that?
2018-01-11 11:35 PM
I guess it can be done in the startup file (*.s).
In Keil world:
http://www.keil.com/support/man/docs/armasm/armasm_dom1361290005934.htm
No sure what you want to achieve at the high level - maybe the problem can be solved different way.
2018-01-12 12:36 AM
BTW. LPC processors have CRP marked this way in the memory at specific address:
IF :LNOT::DEF:NO_CRP
AREA |.ARM.__at_0x02FC|, CODE, READONLY DCD 0xFFFFFFFF ENDIF2018-01-12 03:55 AM
I'd use one of the unused words in the front of the vector table. You could do this by editing the .S file or writing a small C application to modify the word in the .BIN file.
On the STM side use a pointer to access the word.
2018-01-14 09:04 PM
Hi, Clive..
How can I settle down this issue in the C level.
Could you give me an example?
Thanks
2018-01-15 05:53 PM
Hi Bogdan,
I insert your example code in my startup code like the following.
MODULE ?cstartup
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)SECTION .intvec:CODE:NOROOT(2)
EXTERN __iar_program_start
EXTERN SystemInit PUBLIC __vector_tableDATA
__vector_table DCD sfe(CSTACK) DCD Reset_Handler ; Reset HandlerDCD NMI_Handler ; NMI Handler
----------------------------------------------------------------
ENDAREA |.ARM.__at_0x02FC|, CODE, READONLY
DCD 0xFFFFFFFF
But I can't find 0xfffffff at the 0x2FC, defined in the above AREA.
Please refer to the below binary file.
Could you let me know what is wrong?
Thanks, Bogdan.
2018-01-15 06:45 PM
Code past the END is going to be ignored.
From startup.s
...
DATA
__vector_table DCD sfe(CSTACK) DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved <--- this word at +0x1C DCD 0 ; Reserved +0x20 DCD 0 ; Reserved +0x24...
From C
printf('%08X\n', *((uint32_t *)0x0800001C) );
2018-01-15 06:56 PM
>>
Could you let me know what is wrong?
Code past the END is going to be ignored
.
I would avoid AT directive, especially if code is otherwise placed in FLASH at 0x08000000 or 0x08010000
I attached some code, but that post is pending moderation
2018-01-15 11:23 PM
My example was only to show how to use the assembler directive - 2FC location is reserved by the NXP for LPC MCUs to protect (depending on the stored value) the content.