From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id B1A163858281 for ; Fri, 10 Mar 2023 00:08:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1A163858281 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 53D9F1205C5; Fri, 10 Mar 2023 01:08:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1678406924; bh=YZRcaC3C7oG1oTOWsjql1O1Edq4hr8erGaPzWGomtFk=; h=From:To:Subject; b=nqLd+9tvJiVilrgtNvqfbjD2uB3w4P8NBXInzsjuFWs8CSs/8TBXkhVZdoyh2oDoL dKg7QSt6W3LRCY2JY8cWePvEsMaeUHVFVxo+gMQPuWTf5nUgGOLuBuZmtuCHtgpwQq qRpOP9MjOJl9cmaBq4LW+UCbY9Vg1hTP4zNCU0dM= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v1 2/7] SECTOR: ld.texi Date: Fri, 10 Mar 2023 01:08:12 +0100 Message-Id: <20230310000817.751962-3-binutils@emagii.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310000817.751962-1-binutils@emagii.com> References: <20230310000817.751962-1-binutils@emagii.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <167840692369.3747783.3540841063853237540@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_FAIL,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/ld.texi | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/ld/ld.texi b/ld/ld.texi index c21d849fe24..4b4af5fb46b 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -5884,6 +5884,12 @@ calc_crc32 (const unsigned char *input_str, size_t num_bytes) The @code{TIMESTAMP} command creates 64-bit integer with the number of seconds since Epoch (1970-01-01 00:00). +@cindex output section strings +@kindex ALIGN_SECTOR + +The @code{ALIGN_SECTOR} command will align the location counter to the next +flash sector boundary. The sectors are defined by a @code{BANK} command. + @kindex FILL(@var{expression}) @cindex holes, filling @cindex unspecified memory @@ -6574,7 +6580,104 @@ expression via the @code{ORIGIN(@var{memory})} and _fstack = ORIGIN(ram) + LENGTH(ram) - 4; @end group @end smallexample +@page +@node BANK +@section BANK Command +@kindex BANK +@kindex SECTOR +@cindex memory regions +@cindex regions of memory +@cindex allocating memory + +The @code{BANK} command defines the boundaries of flash memory sectors. +It contains a list of @code{SECTOR} commands, each defining symbols for the +@code{begin}, @code{end} and @code{size} of a sector prefixed by the bank name. +You can have multiple banks. The first bank starts at address @code{0x00000000}. +A bank with a name that starts with @code{dummy} is ignored and can be used +as a filler. + +The @code{SECTOR} command has a single string parameter containing the size +of the sector. It can contain a multiplier. Valid multipliers are +@code{BYTES}, @code{KB} and @code{MB} for a multiplier of 1, 1024 and 1024*1024. +@sp 1 +Example of @code{BANK} command defining 3 flash sectors. +@sp 1 +@smallexample +@group + BANK ( bank0 ) @{ + SECTOR ("16 KB"); + SECTOR ("16 KB"); + SECTOR ("32 KB"); + @} +@end group +@end smallexample + +@sp 1 +Example of a @code{BANK} command defining 3 flash sectors combined with +@code{ALIGN_SECTOR} command. +@sp 1 +@smallexample +@group + BANK ( bank0 ) @{ + SECTOR ("1 KB"); + SECTOR ("1 KB"); + SECTOR ("2 KB"); + @} + + SECTIONS + @{ + .text : @{ + sector0 = .; + ASCIZ "sector0" + endstring = .; + ALIGN_SECTOR + sector1 = .; + @} + @} + + sector0 == 0x0000 + endstring == 0x0008 + sector1 == 0x0400 +@end group +@end smallexample +@page + +Example of using a dummy bank to shift the origin to 0x10000. +@sp 1 +@smallexample +@group + BANK ( dummy ) @{ + SECTOR ("64 KB"); + @} + BANK ( bank0 ) @{ + SECTOR ("1 KB"); + SECTOR ("1 KB"); + SECTOR ("2 KB"); + @} + MEMORY @{ + rom : ORIGIN = 0x10000, LENGTH = 0x4000 + ram : ORIGIN = 0x14000, LENGTH = 0x1000 + @} + SECTIONS + @{ + .text : @{ + sector0 = .; + ASCIZ "sector0" + endstring = .; + ALIGN_SECTOR + sector1 = .; + @} > rom + @} + + sector0 == 0x10000 + endstring == 0x10008 + sector1 == 0x10400 +@end group +@end smallexample + + +@page @node PHDRS @section PHDRS Command @kindex PHDRS -- 2.34.1