Include .bin (Bootloader) in Project. I trying to use .incbin in file assenly .S

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Include .bin (Bootloader) in Project. I trying to use .incbin in file assenly .S

1,785 次查看
vdavi81_cefla
Contributor I

I need to insert a Bootloader developed by an employer of my company.

He gives me, a .bin file. I tryied to use .incbin Assembly directive, but at the end of buildind when I check if bootloader is present in section .bootloader (I created this section only for bootloader), I see that the bootloader section is empty. I see only zero value.

{
/* Define each memory region */
m_bootloader (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000
PROGRAM_FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
SRAM_UPPER (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000 /* 64K bytes (alias RAM) */
SRAM_LOWER (rwx) : ORIGIN = 0x1fff0000, LENGTH = 0x10000 /* 64K bytes (alias RAM2) */
FLEX_RAM (rwx) : ORIGIN = 0x14000000, LENGTH = 0x1000 /* 4K bytes (alias RAM3) */
}

SECTIONS
{
.bootloader :
{
. = ALIGN(4);
KEEP (*(.bootloader))
. = ALIGN(4);
} > m_bootloader

/* MAIN TEXT SECTION */
.text : ALIGN(4)
{

 

And the bootloader.S file:


.section .bootloader, "a"
//.align 2

.incbin "/bootloader/Bootloader_MK22_Base.bin"

 

0 项奖励
回复
7 回复数

1,767 次查看
vdavi81_cefla
Contributor I

I that I wrote, but the myBootloader.bin doesn't write in 0x000 position

0 项奖励
回复

1,763 次查看
ErichStyger
Specialist I

then just use the address where you wanna have it.

0 项奖励
回复

1,774 次查看
vdavi81_cefla
Contributor I

Thanks,

but I need to have the values of the firmware (It is a bootloader) starting in the mem address zero.. like shown in figure below:

vdavi81_cefla_0-1670856450415.png

 

0 项奖励
回复

1,775 次查看
ErichStyger
Specialist I

I wrote about including a binary file in the linker file here:

https://mcuoneclipse.com/2022/06/17/include-bin-binary-files-in-a-gnu-linker-file/

I hope this helps,

Erich

0 项奖励
回复

1,771 次查看
ErichStyger
Specialist I

then just use address zero, for example

.text 0x0000 : {
      "myBootloader.bin"
    }    
0 项奖励
回复

1,736 次查看
vdavi81_cefla
Contributor I

I'd like to make some test ... Where I can download Kinetis Flash Tools?

0 项奖励
回复

1,733 次查看
ErichStyger
Specialist I
0 项奖励
回复