How to merge two s19 files to one file?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to merge two s19 files to one file?

Jump to solution
4,755 Views
huaping
Contributor III

we are using KE06, and want to combine two s19 file to one, one file is bootloader, the other is application, so we want to merge them to one, then program it directy.

How to do? the files are attached.

Thanks!

Original Attachment has been moved to: BOOT.hex.zip

Original Attachment has been moved to: APP.hex.zip

1 Solution
3,401 Views
yasuhikokoumoto
Senior Contributor I

Hello Huaping,
you can simply concatenate two files in the following way as

% cat BOOT.hex APP.hex > ALL.hex

and delete S8 or S9 record.

% grep -v 'S[89]' ALL.hex > ALL2.hex

Then you can get it.

% arm-none-eabi-objdump -D -M force-thumb -m armv5te ALL2.hex

ALL2.hex:     file format srec

Disassembly of section .sec1:

00000000 <.sec1>:    0:   3000            adds    r0, #0    2:   2000            movs    r0, #0    4:   09b1            lsrs    r1, r6, #6    6:   0000            movs    r0, r0    8:   0949            lsrs    r1, r1, #5    a:   0000            movs    r0, r0    c:   0949            lsrs    r1, r1, #5         ...   2a:   0000            movs    r0, r0   2c:   0949            lsrs    r1, r1, #5         ... --[snip]--      9b0:       f005 fe38       bl      0x6624      9b4:       f7ff ffce       bl      0x954      9b8:       f7ff ffe8       bl      0x98c      9bc:       f005 fe0a       bl      0x65d4      9c0:       f005 fda6       bl      0x6510      9c4:       f005 fe3c       bl      0x6640      9c8:       4b04            ldr     r3, [pc, #16]   ; (0x9dc) --[snip]--     6624:       4b05            ldr     r3, [pc, #20]   ; (0x663c)     6626:       1c18            adds    r0, r3, #0     6628:       2800            cmp     r0, #0     662a:       d005            beq.n   0x6638     662c:       4685            mov     sp, r0     662e:       b081            sub     sp, #4     6630:       2000            movs    r0, #0     6632:       43c0            mvns    r0, r0     6634:       9000            str     r0, [sp, #0]     6636:       b001            add     sp, #4     6638:       46f7            mov     pc, lr     663a:       4770            bx      lr --[snip]-- Disassembly of section .sec3:

00000400 <.sec3>: 400:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 404:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 408:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 40c:   ffff fffe                       ; <UNDEFINED> instruction: 0xfffffffe

Disassembly of section .sec4:

0000be00 <.sec4>:     be00:       0000            movs    r0, r0     be02:       0cbe            lsrs    r6, r7, #18     be04:       0100            lsls    r0, r0, #4     be06:       ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff     be0a:       ffff a1a1       vaddw.u<illegal width 64>       q13, <illegal reg q15.5>, d17     be0e:       1a1a            subs    r2, r3, r0 --[snip]--

% arm-none-eabi-objcopy -I srec -O binary ALL2.hex ALL2.bin % od -t x2 -A x ALL2.bin 000000 3000 2000 09b1 0000 0949 0000 0949 0000 000010 0000 0000 0000 0000 0000 0000 0000 0000 000020 0000 0000 0000 0000 0000 0000 0949 0000 000030 0000 0000 0000 0000 0949 0000 0949 0000 000040 0949 0000 0949 0000 0949 0000 0949 0000 * 0000c0 0000 0000 0000 0000 0000 0000 0000 0000 * 000400 ffff ffff ffff ffff ffff ffff ffff fffe 000410 0000 0000 0000 0000 0000 0000 0000 0000 * 000800 0000 80c0 0100 ffff ffff ffff a1a1 1a1a 000810 ffff ffff ffff ffff ffff ffff ffff ffff 000820 ffff ffff ffff ffff 0000 0001 5300 4630 000830 ffff ffff ffff ffff ffff ffff ffff ffff * 000880 b402 4671 0849 0049 5609 0049 448e bc02 000890 4770 46c0 b402 4671 0849 0049 5c09 0049 0008a0 448e bc02 4770 46c0 2900 d034 2301 2200 --[snip]--

Isn't it OK?
Best regards,
Yasuhiko Koumoto.

View solution in original post

0 Kudos
5 Replies
3,402 Views
yasuhikokoumoto
Senior Contributor I

Hello Huaping,
you can simply concatenate two files in the following way as

% cat BOOT.hex APP.hex > ALL.hex

and delete S8 or S9 record.

% grep -v 'S[89]' ALL.hex > ALL2.hex

Then you can get it.

% arm-none-eabi-objdump -D -M force-thumb -m armv5te ALL2.hex

ALL2.hex:     file format srec

Disassembly of section .sec1:

00000000 <.sec1>:    0:   3000            adds    r0, #0    2:   2000            movs    r0, #0    4:   09b1            lsrs    r1, r6, #6    6:   0000            movs    r0, r0    8:   0949            lsrs    r1, r1, #5    a:   0000            movs    r0, r0    c:   0949            lsrs    r1, r1, #5         ...   2a:   0000            movs    r0, r0   2c:   0949            lsrs    r1, r1, #5         ... --[snip]--      9b0:       f005 fe38       bl      0x6624      9b4:       f7ff ffce       bl      0x954      9b8:       f7ff ffe8       bl      0x98c      9bc:       f005 fe0a       bl      0x65d4      9c0:       f005 fda6       bl      0x6510      9c4:       f005 fe3c       bl      0x6640      9c8:       4b04            ldr     r3, [pc, #16]   ; (0x9dc) --[snip]--     6624:       4b05            ldr     r3, [pc, #20]   ; (0x663c)     6626:       1c18            adds    r0, r3, #0     6628:       2800            cmp     r0, #0     662a:       d005            beq.n   0x6638     662c:       4685            mov     sp, r0     662e:       b081            sub     sp, #4     6630:       2000            movs    r0, #0     6632:       43c0            mvns    r0, r0     6634:       9000            str     r0, [sp, #0]     6636:       b001            add     sp, #4     6638:       46f7            mov     pc, lr     663a:       4770            bx      lr --[snip]-- Disassembly of section .sec3:

00000400 <.sec3>: 400:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 404:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 408:   ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff 40c:   ffff fffe                       ; <UNDEFINED> instruction: 0xfffffffe

Disassembly of section .sec4:

0000be00 <.sec4>:     be00:       0000            movs    r0, r0     be02:       0cbe            lsrs    r6, r7, #18     be04:       0100            lsls    r0, r0, #4     be06:       ffff ffff                       ; <UNDEFINED> instruction: 0xffffffff     be0a:       ffff a1a1       vaddw.u<illegal width 64>       q13, <illegal reg q15.5>, d17     be0e:       1a1a            subs    r2, r3, r0 --[snip]--

% arm-none-eabi-objcopy -I srec -O binary ALL2.hex ALL2.bin % od -t x2 -A x ALL2.bin 000000 3000 2000 09b1 0000 0949 0000 0949 0000 000010 0000 0000 0000 0000 0000 0000 0000 0000 000020 0000 0000 0000 0000 0000 0000 0949 0000 000030 0000 0000 0000 0000 0949 0000 0949 0000 000040 0949 0000 0949 0000 0949 0000 0949 0000 * 0000c0 0000 0000 0000 0000 0000 0000 0000 0000 * 000400 ffff ffff ffff ffff ffff ffff ffff fffe 000410 0000 0000 0000 0000 0000 0000 0000 0000 * 000800 0000 80c0 0100 ffff ffff ffff a1a1 1a1a 000810 ffff ffff ffff ffff ffff ffff ffff ffff 000820 ffff ffff ffff ffff 0000 0001 5300 4630 000830 ffff ffff ffff ffff ffff ffff ffff ffff * 000880 b402 4671 0849 0049 5609 0049 448e bc02 000890 4770 46c0 b402 4671 0849 0049 5c09 0049 0008a0 448e bc02 4770 46c0 2900 d034 2301 2200 --[snip]--

Isn't it OK?
Best regards,
Yasuhiko Koumoto.

0 Kudos
3,401 Views
BlackNight
NXP Employee
NXP Employee

Hello,

there are multiple ways to do this. I'm using the open source 'SRecord' tool for these kind of things (see  CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse​ how this tool can be used for other tasks too).

I hope this helps,

Erich

0 Kudos
3,401 Views
williamely
Contributor IV

I was going to recommend Srecord but you beat me to it:smileyhappy:

0 Kudos
3,401 Views
huaping
Contributor III

Hi Erich:

    Is it to use srec_cat tooling? I refer to the manual, but still can't find how to merger two files to one, no example.

    Can you help me?

   Thanks a lot!

Fred

0 Kudos
3,401 Views
BlackNight
NXP Employee
NXP Employee

Hello Huaping,

it is as simple as this:

srec_cat app.s19 boot.s19 -o combined.s19

Erich

0 Kudos