From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17197 invoked by alias); 10 Oct 2014 07:55:27 -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 17186 invoked by uid 89); 10 Oct 2014 07:55:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f51.google.com Received: from mail-la0-f51.google.com (HELO mail-la0-f51.google.com) (209.85.215.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 10 Oct 2014 07:55:25 +0000 Received: by mail-la0-f51.google.com with SMTP id ge10so2668597lab.24 for ; Fri, 10 Oct 2014 00:55:21 -0700 (PDT) X-Received: by 10.152.202.167 with SMTP id kj7mr2871489lac.86.1412927721639; Fri, 10 Oct 2014 00:55:21 -0700 (PDT) Received: from sg-pc.belvok.com ([86.57.137.251]) by mx.google.com with ESMTPSA id mn4sm1610150lbb.4.2014.10.10.00.55.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 10 Oct 2014 00:55:20 -0700 (PDT) Date: Fri, 10 Oct 2014 07:55:00 -0000 From: Sergei Gavrikov To: Oleg Uzenkov cc: eCos Discussion In-Reply-To: <5437742F.7020908@unicore.co.ua> Message-ID: References: <542D110B.9080002@unicore.co.ua> <542E8B41.8030905@dallaway.org.uk> <5436726C.8000703@unicore.co.ua> <543696C4.2040201@unicore.co.ua> <5437742F.7020908@unicore.co.ua> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Subject: Re: [ECOS] redboot on STM3240G-EVAL board X-SW-Source: 2014-10/txt/msg00015.txt.bz2 On Fri, 10 Oct 2014, Oleg Uzenkov wrote: > > > > ELF files are quite large, what is the preferred format for an image > > to be passed to redboot? what "load" and "fis create" command look > > like? > > **Roughly** speaking, you save .text segment in FLASH (adjusted to > > flash block erase size), you save not ELF image! So, do not mess > > with binaries. Also `load' command does not carry whole ELF image > > into RAM, but .text segment with a few other segments. > The thing is: > I will need to work with files (new firmware should arrive to sdcard > on the board through ftp in a main app). I want redboot to pick a new ^^^^^^^^^^^ > image up from sdcard at reset. If your board has Ethernet, then you can build RedBoot with networking support and use TFTP or HTTP protocols to load firmware blobs from the NET. Why not? Or you talk about "main app" on a host side? > Extracting sections from received ELF file and transferring them to > redboot is more of a manual work. > So, I think I am kind of stuck with ELF files. > > So I am thinking: > > * Should I load compressed ELF file (gzip) with -d switch? > > * Should I load SREC file (they are usually smaller than ELF)? If you talk about eCos executables (to load) then regardless of the source format you have to keep in a place only sections with LOAD attribute. Look stat -c %s install/tests/kernel/current/tests/tm_basic 608261 Thus, ELF size is 608K. Let's get a binary to load (in RAM for my case) arm-eabi-objcopy -O binary install/tests/kernel/current/tests/tm_basic{,.bin} stat -c %s install/tests/kernel/current/tests/tm_basic.bin 47248 Binary image size is 47K or exactly 47248 bytes. What that 47K is? Let's print all section's headers of ELF arm-eabi-objdump -h install/tests/kernel/current/tests/tm_basic You will see all sections its sizes, locations and even more. But we need to load only the sections which have attribute *LOAD* (not bad name for 'load' command). Filter those sections arm-eabi-objdump -h install/tests/kernel/current/tests/tm_basic | grep LOAD -B1 8 .rom_vectors 00000040 81008000 81008000 00008000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 9 .text 0000a704 81008040 81008040 00008040 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 10 .rodata 00000e60 81012744 81012744 00012744 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 11 .data 000002ec 810135a4 810135a4 000135a4 2**2 CONTENTS, ALLOC, LOAD, DATA Let's calculate sum of all sizes echo "ibase=16; 40+A704+E60+2EC" | bc 47248 We got exactly 47248 bytes. Again, regardless source file format (srec, elf, bin) you have to save on a media *at least* those *LOAD* bytes and you (or loader) have to know all LMA (Load Memory Address) addresses to relocate the sections (if that is needed) in the right places. > * Should I save executable sections and store them in a file. Transfer > that file to sdcard for redboot to pick it up at reset. (nor sure how > to do it actually) What do you want to save? SD card space? Internal FLASH space? Loading time? > * Can I actually load a .bin (image in binary format)? Yes, you can. You would even manage the loading of compressed binary images (.bin.gz). HTH Sergei -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss