From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28137 invoked by alias); 22 Oct 2014 13:17:35 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 28127 invoked by uid 89); 22 Oct 2014 13:17:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f47.google.com Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 22 Oct 2014 13:17:33 +0000 Received: by mail-wg0-f47.google.com with SMTP id x13so3651891wgg.6 for ; Wed, 22 Oct 2014 06:17:31 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.74.237 with SMTP id x13mr5818600wiv.6.1413983850932; Wed, 22 Oct 2014 06:17:30 -0700 (PDT) Received: by 10.180.83.67 with HTTP; Wed, 22 Oct 2014 06:17:30 -0700 (PDT) In-Reply-To: <54479031.9080106@unicore.co.ua> References: <544618E5.90101@unicore.co.ua> <54479031.9080106@unicore.co.ua> Date: Wed, 22 Oct 2014 13:17:00 -0000 Message-ID: From: Edgar Grimberg To: Oleg Uzenkov Cc: eCos Discussion Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Subject: Re: [ECOS] small custom bootloader to start an app stored in flash X-SW-Source: 2014-10/txt/msg00035.txt.bz2 > > May be I am missing something in the understanding of the principles. > I don't see anything obviously broken (I guess you would have spotted it). If you have a JTAG debugger, now it's a good time to make use of it: 1. Check that you don't reach the infinite loop in your bootloader application. 2. Insert a hardware breakpoint at address 0x08020000, to see if you call the correct address from the bootloader. 3. Try single stepping when you get to 0x08020000, see if the code makes sense. 4. Try starting your application (0x08020000) from the debugger directly, see if you get the printf. > ROM startup build copies .data and .bss sections into ram, probably these > sections data gets overwritten. They should get overwritten by the app startup sequence. This is OK. > Do I need to shift addresses of SECTION_sram, SECTION_data, SECTION_bss in > app's memory layout? No, you won't need anything from the bootloader, you'll never return execution to the bootloader (unless you reset the board). > $ arm-none-eabi-readelf -h app.elf > ELF Header: > Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 > Class: ELF32 > Data: 2's complement, little endian > Version: 1 (current) > OS/ABI: UNIX - System V > ABI Version: 0 > Type: EXEC (Executable file) > Machine: ARM > Version: 0x1 > Entry point address: 0x8020111 As pointed previously, there is something strange with this address. Can you try jumping to it from the bootloader? Edgar > Start of program headers: 52 (bytes into file) > Start of section headers: 24148 (bytes into file) > Flags: 0x5000002, has entry point, Version5 > EABI > Size of this header: 52 (bytes) > Size of program headers: 32 (bytes) > Number of program headers: 3 > Size of section headers: 40 (bytes) > Number of section headers: 12 > Section header string table index: 11 > > $ arm-none-eabi-objdump -h app.elf > > app.elf: file format elf32-littlearm > > Sections: > Idx Name Size VMA LMA File off Algn > 0 .rom_vectors 00000008 08020000 08020000 00000098 2**0 > CONTENTS, ALLOC, LOAD, READONLY, CODE > 1 .ARM.extab 0000003c 08020008 08020008 000000a0 2**2 > CONTENTS, ALLOC, LOAD, READONLY, DATA > 2 .ARM.exidx 000000c8 08020048 08020048 000000e0 2**2 > CONTENTS, ALLOC, LOAD, READONLY, DATA > 3 .text 0000586c 08020110 08020110 000001a8 2**3 > CONTENTS, ALLOC, LOAD, READONLY, CODE > 4 .rodata 0000010d 08025980 08025980 00005a18 2**2 > CONTENTS, ALLOC, LOAD, READONLY, DATA > 5 .eh_frame 00000008 08025a90 08025a90 00005b25 2**0 > ALLOC > 6 .data 00000268 20000288 08025a98 00005b28 2**3 > CONTENTS, ALLOC, LOAD, DATA > 7 .bss 000034e8 200004f0 08025d00 00005d90 2**3 > ALLOC > 8 .ARM.attributes 0000002d 00000000 00000000 00005d90 2**0 > CONTENTS, READONLY > 9 .comment 0000002a 00000000 00000000 00005dbd 2**0 > CONTENTS, READONLY > > > > > > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss