* RWX load segment MSP430 back-end
@ 2023-01-18 16:31 Orlando Arias
2023-01-19 11:45 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Orlando Arias @ 2023-01-18 16:31 UTC (permalink / raw)
To: binutils
[-- Attachment #1.1.1: Type: text/plain, Size: 4771 bytes --]
Greetings,
I ran into a rather puzzling issue with ld.bfd for the MSP430 target
with binutils 2.40, gcc 12.2, and newlib 4.2.0.20211231. Consider the
following program:
#include <msp430.h>
void main(void) {
WDTCTL = WDTPW | WDTHOLD;
P3DIR = BIT4;
P3OUT &= ~BIT4;
while(1) {
__delay_cycles(2500000);
P3OUT ^= BIT4;
}
}
Build and link the program as:
$ msp430-elf-gcc -mmcu=msp430fr5739 -Wall -Wno-main -Werror \
-ffunction-sections -fdata-sections -Os -c -o gpio.o gpio.c
$ msp430-elf-gcc -mmcu=msp430fr5739 -Wl,--gc-sections -\
o binary.elf gpio.o
The linker script used is from the TI support files found at [1,2]. I am
attaching it here for convenience. When linking, I get the following
warning:
/usr/bin/msp430-elf-ld: warning: binary.elf has a LOAD segment with RWX
permissions
and indeed, when examining the binary in question (also attached), I see
$ msp430-elf-readelf -l binary.elf
Elf file type is EXEC (Executable file)
Entry point 0xc208
There are 4 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000c14c 0x0000c14c 0x0016e 0x0016e RWE 0x4
LOAD 0x000000 0x00001c00 0x0000c2ba 0x00000 0x00010 RW 0x4
LOAD 0x000000 0x00001c10 0x0000c2ba 0x00000 0x00004 RW 0x4
LOAD 0x00016e 0x0000fffe 0x0000fffe 0x00002 0x00002 R 0x4
Well, indeed there is something that gets placed at 0xc14c that is read
write and executable. However, the MSP430FR5739 has nothing on that
memory region! In fact, looking at the linker scripts reveals nothing
that should be placed there, unless I am missing something of course.
For that matter, when running size on the binary, I get:
$ msp430-elf-size binary.elf
text data bss dec hex filename
180 8 20 208 d0 binary.elf
Which is also interesting. When looking into readelf, I see:
$ msp430-elf-readelf -S binary.elf
There are 20 section headers, starting at offset 0xb08:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg
Lk Inf Al
[ 0] NULL 00000000 000000 000000 00
0 0 0
[ 1] __reset_vector PROGBITS 0000fffe 000182 000002 00 A
0 0 1
[ 2] .rodata PROGBITS 0000c200 000184 000000 00 WA
0 0 1
[ 3] .rodata2 INIT_ARRAY 0000c200 0000b4 000008 04 WA
0 0 4
[ 4] .persistent PROGBITS 0000c208 000184 000000 00 WA
0 0 1
[ 5] .text PROGBITS 0000c208 0000bc 0000c4 00 AX
0 0 2
[ 6] .data PROGBITS 00001c00 000184 000000 00 WA
0 0 1
[ 7] .bss NOBITS 00001c00 000180 000010 00 WA
0 0 2
[ 8] .noinit NOBITS 00001c10 000000 000000 00 WA
0 0 1
[ 9] .heap NOBITS 00001c10 000180 000004 00 WA
0 0 1
[10] .MSP430.attr[...] MSP430_ATTRIBUT 00000000 000184 000017 00
0 0 1
[...snip...]
Which reveals a 0 length .data section and a 16 byte .bss section.
Looking into symbols to see what got placed where, I see:
$ msp430-elf-nm -n binary.elf
[relevant parts shown only]
00001c00 D _edata
00001c10 B _end
00001c10 B end
00001c10 B __heap_start__
00001c14 B __heap_end__
00001c14 B __HeapLimit
00002000 N __stack
0000c208 T __crt0_start
0000c208 T _start
[...snip...]
which makes it look like something went into .bss after all. I am
guessing it is because of all the ALIGN() stuff in the ldscript?
In any case, I have no idea where extraneous segment is coming from.
Nothing on the binary indicates that it should exist, and there is
nothing in the memory map of the MSP430 in question in that area. I did
notice that a patch was submitted to treat the cris*-elf backend in a
special way by defaulting to --no-warn-rwx-segment which I guess could
be done as well for the MSP430. There is no MMU on the MSP430 (there is
an MPU on the FR5739 which I am using for the example above, but it must
be manually configured by the software running on the platform). This
could also be applied to the MSP430 but it feels like a workaround that
may be hiding a different problem. Could someone shed some light as to
what is going on here? Thank you for your time and efforts.
Cheers,
Orlando.
[1] https://www.ti.com/tool/MSP430-GCC-OPENSOURCE#downloads
[2]
https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-support-files-1.212.zip
[3] https://sourceware.org/pipermail/binutils/2022-May/121065.html
[-- Attachment #1.1.2: msp430fr5739.ld --]
[-- Type: text/plain, Size: 18611 bytes --]
/* ============================================================================ */
/* Copyright (c) 2021, Texas Instruments Incorporated */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* * Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* * Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* */
/* * Neither the name of Texas Instruments Incorporated nor the names of */
/* its contributors may be used to endorse or promote products derived */
/* from this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
/* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* ============================================================================ */
/* This file supports MSP430FR5739 devices. */
/* Version: 1.212 */
/* Default linker script, for normal executables */
OUTPUT_ARCH(msp430)
ENTRY(_start)
MEMORY {
SFR : ORIGIN = 0x0000, LENGTH = 0x0010 /* END=0x0010, size 16 */
BSL : ORIGIN = 0x1000, LENGTH = 0x0800
RAM : ORIGIN = 0x1C00, LENGTH = 0x0400 /* END=0x1FFF, size 1024 */
INFOMEM : ORIGIN = 0x1800, LENGTH = 0x0100 /* END=0x18FF, size 256 as 2 128-byte segments */
INFOA : ORIGIN = 0x1880, LENGTH = 0x0080 /* END=0x18FF, size 128 */
INFOB : ORIGIN = 0x1800, LENGTH = 0x0080 /* END=0x187F, size 128 */
FRAM (rx) : ORIGIN = 0xC200, LENGTH = 0x3D80 /* END=0xFF7F, size 15744 */
JTAGSIGNATURE : ORIGIN = 0xFF80, LENGTH = 0x0004
BSLSIGNATURE : ORIGIN = 0xFF84, LENGTH = 0x0004
IPESIGNATURE : ORIGIN = 0xFF88, LENGTH = 0x0008
VECT1 : ORIGIN = 0xFF90, LENGTH = 0x0002
VECT2 : ORIGIN = 0xFF92, LENGTH = 0x0002
VECT3 : ORIGIN = 0xFF94, LENGTH = 0x0002
VECT4 : ORIGIN = 0xFF96, LENGTH = 0x0002
VECT5 : ORIGIN = 0xFF98, LENGTH = 0x0002
VECT6 : ORIGIN = 0xFF9A, LENGTH = 0x0002
VECT7 : ORIGIN = 0xFF9C, LENGTH = 0x0002
VECT8 : ORIGIN = 0xFF9E, LENGTH = 0x0002
VECT9 : ORIGIN = 0xFFA0, LENGTH = 0x0002
VECT10 : ORIGIN = 0xFFA2, LENGTH = 0x0002
VECT11 : ORIGIN = 0xFFA4, LENGTH = 0x0002
VECT12 : ORIGIN = 0xFFA6, LENGTH = 0x0002
VECT13 : ORIGIN = 0xFFA8, LENGTH = 0x0002
VECT14 : ORIGIN = 0xFFAA, LENGTH = 0x0002
VECT15 : ORIGIN = 0xFFAC, LENGTH = 0x0002
VECT16 : ORIGIN = 0xFFAE, LENGTH = 0x0002
VECT17 : ORIGIN = 0xFFB0, LENGTH = 0x0002
VECT18 : ORIGIN = 0xFFB2, LENGTH = 0x0002
VECT19 : ORIGIN = 0xFFB4, LENGTH = 0x0002
VECT20 : ORIGIN = 0xFFB6, LENGTH = 0x0002
VECT21 : ORIGIN = 0xFFB8, LENGTH = 0x0002
VECT22 : ORIGIN = 0xFFBA, LENGTH = 0x0002
VECT23 : ORIGIN = 0xFFBC, LENGTH = 0x0002
VECT24 : ORIGIN = 0xFFBE, LENGTH = 0x0002
VECT25 : ORIGIN = 0xFFC0, LENGTH = 0x0002
VECT26 : ORIGIN = 0xFFC2, LENGTH = 0x0002
VECT27 : ORIGIN = 0xFFC4, LENGTH = 0x0002
VECT28 : ORIGIN = 0xFFC6, LENGTH = 0x0002
VECT29 : ORIGIN = 0xFFC8, LENGTH = 0x0002
VECT30 : ORIGIN = 0xFFCA, LENGTH = 0x0002
VECT31 : ORIGIN = 0xFFCC, LENGTH = 0x0002
VECT32 : ORIGIN = 0xFFCE, LENGTH = 0x0002
VECT33 : ORIGIN = 0xFFD0, LENGTH = 0x0002
VECT34 : ORIGIN = 0xFFD2, LENGTH = 0x0002
VECT35 : ORIGIN = 0xFFD4, LENGTH = 0x0002
VECT36 : ORIGIN = 0xFFD6, LENGTH = 0x0002
VECT37 : ORIGIN = 0xFFD8, LENGTH = 0x0002
VECT38 : ORIGIN = 0xFFDA, LENGTH = 0x0002
VECT39 : ORIGIN = 0xFFDC, LENGTH = 0x0002
VECT40 : ORIGIN = 0xFFDE, LENGTH = 0x0002
VECT41 : ORIGIN = 0xFFE0, LENGTH = 0x0002
VECT42 : ORIGIN = 0xFFE2, LENGTH = 0x0002
VECT43 : ORIGIN = 0xFFE4, LENGTH = 0x0002
VECT44 : ORIGIN = 0xFFE6, LENGTH = 0x0002
VECT45 : ORIGIN = 0xFFE8, LENGTH = 0x0002
VECT46 : ORIGIN = 0xFFEA, LENGTH = 0x0002
VECT47 : ORIGIN = 0xFFEC, LENGTH = 0x0002
VECT48 : ORIGIN = 0xFFEE, LENGTH = 0x0002
VECT49 : ORIGIN = 0xFFF0, LENGTH = 0x0002
VECT50 : ORIGIN = 0xFFF2, LENGTH = 0x0002
VECT51 : ORIGIN = 0xFFF4, LENGTH = 0x0002
VECT52 : ORIGIN = 0xFFF6, LENGTH = 0x0002
VECT53 : ORIGIN = 0xFFF8, LENGTH = 0x0002
VECT54 : ORIGIN = 0xFFFA, LENGTH = 0x0002
VECT55 : ORIGIN = 0xFFFC, LENGTH = 0x0002
RESETVEC : ORIGIN = 0xFFFE, LENGTH = 0x0002
}
SECTIONS
{
.jtagsignature : {} > JTAGSIGNATURE
.bslsignature : {} > BSLSIGNATURE
.ipe :
{
KEEP (*(.ipesignature))
KEEP (*(.jtagpassword))
} > IPESIGNATURE
__interrupt_vector_1 : { KEEP (*(__interrupt_vector_1 )) } > VECT1
__interrupt_vector_2 : { KEEP (*(__interrupt_vector_2 )) } > VECT2
__interrupt_vector_3 : { KEEP (*(__interrupt_vector_3 )) } > VECT3
__interrupt_vector_4 : { KEEP (*(__interrupt_vector_4 )) } > VECT4
__interrupt_vector_5 : { KEEP (*(__interrupt_vector_5 )) } > VECT5
__interrupt_vector_6 : { KEEP (*(__interrupt_vector_6 )) } > VECT6
__interrupt_vector_7 : { KEEP (*(__interrupt_vector_7 )) } > VECT7
__interrupt_vector_8 : { KEEP (*(__interrupt_vector_8 )) } > VECT8
__interrupt_vector_9 : { KEEP (*(__interrupt_vector_9 )) } > VECT9
__interrupt_vector_10 : { KEEP (*(__interrupt_vector_10)) } > VECT10
__interrupt_vector_11 : { KEEP (*(__interrupt_vector_11)) } > VECT11
__interrupt_vector_12 : { KEEP (*(__interrupt_vector_12)) } > VECT12
__interrupt_vector_13 : { KEEP (*(__interrupt_vector_13)) } > VECT13
__interrupt_vector_14 : { KEEP (*(__interrupt_vector_14)) } > VECT14
__interrupt_vector_15 : { KEEP (*(__interrupt_vector_15)) } > VECT15
__interrupt_vector_16 : { KEEP (*(__interrupt_vector_16)) } > VECT16
__interrupt_vector_17 : { KEEP (*(__interrupt_vector_17)) } > VECT17
__interrupt_vector_18 : { KEEP (*(__interrupt_vector_18)) } > VECT18
__interrupt_vector_19 : { KEEP (*(__interrupt_vector_19)) } > VECT19
__interrupt_vector_20 : { KEEP (*(__interrupt_vector_20)) } > VECT20
__interrupt_vector_21 : { KEEP (*(__interrupt_vector_21)) } > VECT21
__interrupt_vector_22 : { KEEP (*(__interrupt_vector_22)) } > VECT22
__interrupt_vector_23 : { KEEP (*(__interrupt_vector_23)) } > VECT23
__interrupt_vector_24 : { KEEP (*(__interrupt_vector_24)) } > VECT24
__interrupt_vector_25 : { KEEP (*(__interrupt_vector_25)) } > VECT25
__interrupt_vector_26 : { KEEP (*(__interrupt_vector_26)) } > VECT26
__interrupt_vector_27 : { KEEP (*(__interrupt_vector_27)) } > VECT27
__interrupt_vector_28 : { KEEP (*(__interrupt_vector_28)) } > VECT28
__interrupt_vector_29 : { KEEP (*(__interrupt_vector_29)) } > VECT29
__interrupt_vector_30 : { KEEP (*(__interrupt_vector_30)) } > VECT30
__interrupt_vector_31 : { KEEP (*(__interrupt_vector_31)) } > VECT31
__interrupt_vector_32 : { KEEP (*(__interrupt_vector_32)) KEEP (*(__interrupt_vector_rtc)) } > VECT32
__interrupt_vector_33 : { KEEP (*(__interrupt_vector_33)) KEEP (*(__interrupt_vector_port4)) } > VECT33
__interrupt_vector_34 : { KEEP (*(__interrupt_vector_34)) KEEP (*(__interrupt_vector_port3)) } > VECT34
__interrupt_vector_35 : { KEEP (*(__interrupt_vector_35)) KEEP (*(__interrupt_vector_timer2_b1)) } > VECT35
__interrupt_vector_36 : { KEEP (*(__interrupt_vector_36)) KEEP (*(__interrupt_vector_timer2_b0)) } > VECT36
__interrupt_vector_37 : { KEEP (*(__interrupt_vector_37)) KEEP (*(__interrupt_vector_port2)) } > VECT37
__interrupt_vector_38 : { KEEP (*(__interrupt_vector_38)) KEEP (*(__interrupt_vector_timer1_b1)) } > VECT38
__interrupt_vector_39 : { KEEP (*(__interrupt_vector_39)) KEEP (*(__interrupt_vector_timer1_b0)) } > VECT39
__interrupt_vector_40 : { KEEP (*(__interrupt_vector_40)) KEEP (*(__interrupt_vector_port1)) } > VECT40
__interrupt_vector_41 : { KEEP (*(__interrupt_vector_41)) KEEP (*(__interrupt_vector_timer1_a1)) } > VECT41
__interrupt_vector_42 : { KEEP (*(__interrupt_vector_42)) KEEP (*(__interrupt_vector_timer1_a0)) } > VECT42
__interrupt_vector_43 : { KEEP (*(__interrupt_vector_43)) KEEP (*(__interrupt_vector_dma)) } > VECT43
__interrupt_vector_44 : { KEEP (*(__interrupt_vector_44)) KEEP (*(__interrupt_vector_usci_a1)) } > VECT44
__interrupt_vector_45 : { KEEP (*(__interrupt_vector_45)) KEEP (*(__interrupt_vector_timer0_a1)) } > VECT45
__interrupt_vector_46 : { KEEP (*(__interrupt_vector_46)) KEEP (*(__interrupt_vector_timer0_a0)) } > VECT46
__interrupt_vector_47 : { KEEP (*(__interrupt_vector_47)) KEEP (*(__interrupt_vector_adc10)) } > VECT47
__interrupt_vector_48 : { KEEP (*(__interrupt_vector_48)) KEEP (*(__interrupt_vector_usci_b0)) } > VECT48
__interrupt_vector_49 : { KEEP (*(__interrupt_vector_49)) KEEP (*(__interrupt_vector_usci_a0)) } > VECT49
__interrupt_vector_50 : { KEEP (*(__interrupt_vector_50)) KEEP (*(__interrupt_vector_wdt)) } > VECT50
__interrupt_vector_51 : { KEEP (*(__interrupt_vector_51)) KEEP (*(__interrupt_vector_timer0_b1)) } > VECT51
__interrupt_vector_52 : { KEEP (*(__interrupt_vector_52)) KEEP (*(__interrupt_vector_timer0_b0)) } > VECT52
__interrupt_vector_53 : { KEEP (*(__interrupt_vector_53)) KEEP (*(__interrupt_vector_comp_d)) } > VECT53
__interrupt_vector_54 : { KEEP (*(__interrupt_vector_54)) KEEP (*(__interrupt_vector_unmi)) } > VECT54
__interrupt_vector_55 : { KEEP (*(__interrupt_vector_55)) KEEP (*(__interrupt_vector_sysnmi)) } > VECT55
__reset_vector :
{
KEEP (*(__interrupt_vector_56))
KEEP (*(__interrupt_vector_reset))
KEEP (*(.resetvec))
} > RESETVEC
.rodata :
{
. = ALIGN(2);
*(.plt)
*(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
*(.rodata1)
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
} > FRAM
/* Note: This is a separate .rodata section for sections which are
read only but which older linkers treat as read-write.
This prevents older linkers from marking the entire .rodata
section as read-write. */
.rodata2 :
{
. = ALIGN(2);
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
. = ALIGN(2);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
. = ALIGN(2);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE (__fini_array_end = .);
. = ALIGN(2);
*(.eh_frame_hdr)
KEEP (*(.eh_frame))
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from the crtend.o
file until after the sorted ctors. The .ctor section from
the crtend file contains the end of ctors marker and it must
be last */
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} > FRAM
/* This section contains data that is initialised during load
but not on application reset. */
.persistent :
{
. = ALIGN(2);
PROVIDE (__persistent_start = .);
*(.persistent)
. = ALIGN(2);
PROVIDE (__persistent_end = .);
} > FRAM
.text :
{
. = ALIGN(2);
PROVIDE (_start = .);
KEEP (*(SORT(.crt_*)))
*(.lowtext .text .stub .text.* .gnu.linkonce.t.* .text:*)
KEEP (*(.text.*personality*))
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.interp .hash .dynsym .dynstr .gnu.version*)
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
. = ALIGN(2);
KEEP (*(.init))
KEEP (*(.fini))
KEEP (*(.tm_clone_table))
} > FRAM
.data :
{
. = ALIGN(2);
PROVIDE (__datastart = .);
KEEP (*(.jcr))
*(.data.rel.ro.local) *(.data.rel.ro*)
*(.dynamic)
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
*(.data1)
*(.got.plt) *(.got)
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
. = ALIGN(2);
*(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
. = ALIGN(2);
_edata = .;
PROVIDE (edata = .);
PROVIDE (__dataend = .);
} > RAM AT> FRAM
/* Note that crt0 assumes this is a multiple of two; all the
start/stop symbols are also assumed word-aligned. */
PROVIDE(__romdatastart = LOADADDR(.data));
PROVIDE (__romdatacopysize = SIZEOF(.data));
.bss :
{
. = ALIGN(2);
PROVIDE (__bssstart = .);
*(.dynbss)
*(.sbss .sbss.*)
*(.bss .bss.* .gnu.linkonce.b.*)
. = ALIGN(2);
*(COMMON)
PROVIDE (__bssend = .);
} > RAM
PROVIDE (__bsssize = SIZEOF(.bss));
/* This section contains data that is not initialised during load
or application reset. */
.noinit (NOLOAD) :
{
. = ALIGN(2);
PROVIDE (__noinit_start = .);
*(.noinit)
. = ALIGN(2);
PROVIDE (__noinit_end = .);
end = .;
} > RAM
/* We create this section so that "end" will always be in the
RAM region (matching .stack below), even if the .bss
section is empty. */
.heap (NOLOAD) :
{
. = ALIGN(2);
__heap_start__ = .;
_end = __heap_start__;
PROVIDE (end = .);
KEEP (*(.heap))
_end = .;
PROVIDE (end = .);
/* This word is here so that the section is not empty, and thus
not discarded by the linker. The actual value does not matter
and is ignored. */
LONG(0);
__heap_end__ = .;
__HeapLimit = __heap_end__;
} > RAM
/* WARNING: Do not place anything in RAM here.
The heap section must be the last section in RAM and the stack
section must be placed at the very end of the RAM region. */
.stack (ORIGIN (RAM) + LENGTH(RAM)) :
{
PROVIDE (__stack = .);
*(.stack)
}
.infoA (NOLOAD) : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */
.infoB (NOLOAD) : {} > INFOB
/* The rest are all not normally part of the runtime image. */
.MSP430.attributes 0 :
{
KEEP (*(.MSP430.attributes))
KEEP (*(.gnu.attributes))
KEEP (*(__TI_build_attributes))
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1. */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions. */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2. */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2. */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions. */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
.debug_macro 0 : { *(.debug_macro) }
/DISCARD/ : { *(.note.GNU-stack) }
}
/****************************************************************************/
/* Include peripherals memory map */
/****************************************************************************/
INCLUDE msp430fr5739_symbols.ld
[-- Attachment #1.1.3: msp430fr5739_symbols.ld --]
[-- Type: text/plain, Size: 27245 bytes --]
/* ============================================================================ */
/* Copyright (c) 2021, Texas Instruments Incorporated */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* * Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* * Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* */
/* * Neither the name of Texas Instruments Incorporated nor the names of */
/* its contributors may be used to endorse or promote products derived */
/* from this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
/* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* ============================================================================ */
/* This file supports MSP430FR5739 devices. */
/* Version: 1.212 */
/************************************************************
* STANDARD BITS
************************************************************/
/************************************************************
* STATUS REGISTER BITS
************************************************************/
/************************************************************
* PERIPHERAL FILE MAP
************************************************************/
/************************************************************
* ADC10_B
************************************************************/
PROVIDE(ADC10CTL0 = 0x0700);
PROVIDE(ADC10CTL0_L = 0x0700);
PROVIDE(ADC10CTL0_H = 0x0701);
PROVIDE(ADC10CTL1 = 0x0702);
PROVIDE(ADC10CTL1_L = 0x0702);
PROVIDE(ADC10CTL1_H = 0x0703);
PROVIDE(ADC10CTL2 = 0x0704);
PROVIDE(ADC10CTL2_L = 0x0704);
PROVIDE(ADC10CTL2_H = 0x0705);
PROVIDE(ADC10LO = 0x0706);
PROVIDE(ADC10LO_L = 0x0706);
PROVIDE(ADC10LO_H = 0x0707);
PROVIDE(ADC10HI = 0x0708);
PROVIDE(ADC10HI_L = 0x0708);
PROVIDE(ADC10HI_H = 0x0709);
PROVIDE(ADC10MCTL0 = 0x070A);
PROVIDE(ADC10MCTL0_L = 0x070A);
PROVIDE(ADC10MCTL0_H = 0x070B);
PROVIDE(ADC10MEM0 = 0x0712);
PROVIDE(ADC10MEM0_L = 0x0712);
PROVIDE(ADC10MEM0_H = 0x0713);
PROVIDE(ADC10IE = 0x071A);
PROVIDE(ADC10IE_L = 0x071A);
PROVIDE(ADC10IE_H = 0x071B);
PROVIDE(ADC10IFG = 0x071C);
PROVIDE(ADC10IFG_L = 0x071C);
PROVIDE(ADC10IFG_H = 0x071D);
PROVIDE(ADC10IV = 0x071E);
PROVIDE(ADC10IV_L = 0x071E);
PROVIDE(ADC10IV_H = 0x071F);
/************************************************************
* CLOCK SYSTEM
************************************************************/
PROVIDE(CSCTL0 = 0x0160);
PROVIDE(CSCTL0_L = 0x0160);
PROVIDE(CSCTL0_H = 0x0161);
PROVIDE(CSCTL1 = 0x0162);
PROVIDE(CSCTL1_L = 0x0162);
PROVIDE(CSCTL1_H = 0x0163);
PROVIDE(CSCTL2 = 0x0164);
PROVIDE(CSCTL2_L = 0x0164);
PROVIDE(CSCTL2_H = 0x0165);
PROVIDE(CSCTL3 = 0x0166);
PROVIDE(CSCTL3_L = 0x0166);
PROVIDE(CSCTL3_H = 0x0167);
PROVIDE(CSCTL4 = 0x0168);
PROVIDE(CSCTL4_L = 0x0168);
PROVIDE(CSCTL4_H = 0x0169);
PROVIDE(CSCTL5 = 0x016A);
PROVIDE(CSCTL5_L = 0x016A);
PROVIDE(CSCTL5_H = 0x016B);
PROVIDE(CSCTL6 = 0x016C);
PROVIDE(CSCTL6_L = 0x016C);
PROVIDE(CSCTL6_H = 0x016D);
/************************************************************
* Comparator D
************************************************************/
PROVIDE(CDCTL0 = 0x08C0);
PROVIDE(CDCTL0_L = 0x08C0);
PROVIDE(CDCTL0_H = 0x08C1);
PROVIDE(CDCTL1 = 0x08C2);
PROVIDE(CDCTL1_L = 0x08C2);
PROVIDE(CDCTL1_H = 0x08C3);
PROVIDE(CDCTL2 = 0x08C4);
PROVIDE(CDCTL2_L = 0x08C4);
PROVIDE(CDCTL2_H = 0x08C5);
PROVIDE(CDCTL3 = 0x08C6);
PROVIDE(CDCTL3_L = 0x08C6);
PROVIDE(CDCTL3_H = 0x08C7);
PROVIDE(CDINT = 0x08CC);
PROVIDE(CDINT_L = 0x08CC);
PROVIDE(CDINT_H = 0x08CD);
PROVIDE(CDIV = 0x08CE);
PROVIDE(CDIV_L = 0x08CE);
PROVIDE(CDIV_H = 0x08CF);
/*************************************************************
* CRC Module
*************************************************************/
PROVIDE(CRCDI = 0x0150);
PROVIDE(CRCDI_L = 0x0150);
PROVIDE(CRCDI_H = 0x0151);
PROVIDE(CRCDIRB = 0x0152);
PROVIDE(CRCDIRB_L = 0x0152);
PROVIDE(CRCDIRB_H = 0x0153);
PROVIDE(CRCINIRES = 0x0154);
PROVIDE(CRCINIRES_L = 0x0154);
PROVIDE(CRCINIRES_H = 0x0155);
PROVIDE(CRCRESR = 0x0156);
PROVIDE(CRCRESR_L = 0x0156);
PROVIDE(CRCRESR_H = 0x0157);
/************************************************************
* DMA_X
************************************************************/
PROVIDE(DMACTL0 = 0x0500);
PROVIDE(DMACTL1 = 0x0502);
PROVIDE(DMACTL2 = 0x0504);
PROVIDE(DMACTL3 = 0x0506);
PROVIDE(DMACTL4 = 0x0508);
PROVIDE(DMAIV = 0x050E);
PROVIDE(DMA0CTL = 0x0510);
PROVIDE(DMA0SA = 0x0512);
PROVIDE(DMA0SAL = 0x0512);
PROVIDE(DMA0DA = 0x0516);
PROVIDE(DMA0DAL = 0x0516);
PROVIDE(DMA0SZ = 0x051A);
PROVIDE(DMA1CTL = 0x0520);
PROVIDE(DMA1SA = 0x0522);
PROVIDE(DMA1SAL = 0x0522);
PROVIDE(DMA1DA = 0x0526);
PROVIDE(DMA1DAL = 0x0526);
PROVIDE(DMA1SZ = 0x052A);
PROVIDE(DMA2CTL = 0x0530);
PROVIDE(DMA2SA = 0x0532);
PROVIDE(DMA2SAL = 0x0532);
PROVIDE(DMA2DA = 0x0536);
PROVIDE(DMA2DAL = 0x0536);
PROVIDE(DMA2SZ = 0x053A);
/*************************************************************
* FRAM Memory
*************************************************************/
PROVIDE(FRCTL0 = 0x0140);
PROVIDE(FRCTL0_L = 0x0140);
PROVIDE(FRCTL0_H = 0x0141);
PROVIDE(GCCTL0 = 0x0144);
PROVIDE(GCCTL0_L = 0x0144);
PROVIDE(GCCTL0_H = 0x0145);
PROVIDE(GCCTL1 = 0x0146);
PROVIDE(GCCTL1_L = 0x0146);
PROVIDE(GCCTL1_H = 0x0147);
/************************************************************
* Memory Protection Unit
************************************************************/
PROVIDE(MPUCTL0 = 0x05A0);
PROVIDE(MPUCTL0_L = 0x05A0);
PROVIDE(MPUCTL0_H = 0x05A1);
PROVIDE(MPUCTL1 = 0x05A2);
PROVIDE(MPUCTL1_L = 0x05A2);
PROVIDE(MPUCTL1_H = 0x05A3);
PROVIDE(MPUSEG = 0x05A4);
PROVIDE(MPUSEG_L = 0x05A4);
PROVIDE(MPUSEG_H = 0x05A5);
PROVIDE(MPUSAM = 0x05A6);
PROVIDE(MPUSAM_L = 0x05A6);
PROVIDE(MPUSAM_H = 0x05A7);
/************************************************************
* HARDWARE MULTIPLIER 32Bit
************************************************************/
PROVIDE(MPY = 0x04C0);
PROVIDE(MPY_L = 0x04C0);
PROVIDE(MPY_H = 0x04C1);
PROVIDE(MPYS = 0x04C2);
PROVIDE(MPYS_L = 0x04C2);
PROVIDE(MPYS_H = 0x04C3);
PROVIDE(MAC = 0x04C4);
PROVIDE(MAC_L = 0x04C4);
PROVIDE(MAC_H = 0x04C5);
PROVIDE(MACS = 0x04C6);
PROVIDE(MACS_L = 0x04C6);
PROVIDE(MACS_H = 0x04C7);
PROVIDE(OP2 = 0x04C8);
PROVIDE(OP2_L = 0x04C8);
PROVIDE(OP2_H = 0x04C9);
PROVIDE(RESLO = 0x04CA);
PROVIDE(RESLO_L = 0x04CA);
PROVIDE(RESLO_H = 0x04CB);
PROVIDE(RESHI = 0x04CC);
PROVIDE(RESHI_L = 0x04CC);
PROVIDE(RESHI_H = 0x04CD);
PROVIDE(SUMEXT = 0x04CE);
PROVIDE(SUMEXT_L = 0x04CE);
PROVIDE(SUMEXT_H = 0x04CF);
PROVIDE(MPY32L = 0x04D0);
PROVIDE(MPY32L_L = 0x04D0);
PROVIDE(MPY32L_H = 0x04D1);
PROVIDE(MPY32H = 0x04D2);
PROVIDE(MPY32H_L = 0x04D2);
PROVIDE(MPY32H_H = 0x04D3);
PROVIDE(MPYS32L = 0x04D4);
PROVIDE(MPYS32L_L = 0x04D4);
PROVIDE(MPYS32L_H = 0x04D5);
PROVIDE(MPYS32H = 0x04D6);
PROVIDE(MPYS32H_L = 0x04D6);
PROVIDE(MPYS32H_H = 0x04D7);
PROVIDE(MAC32L = 0x04D8);
PROVIDE(MAC32L_L = 0x04D8);
PROVIDE(MAC32L_H = 0x04D9);
PROVIDE(MAC32H = 0x04DA);
PROVIDE(MAC32H_L = 0x04DA);
PROVIDE(MAC32H_H = 0x04DB);
PROVIDE(MACS32L = 0x04DC);
PROVIDE(MACS32L_L = 0x04DC);
PROVIDE(MACS32L_H = 0x04DD);
PROVIDE(MACS32H = 0x04DE);
PROVIDE(MACS32H_L = 0x04DE);
PROVIDE(MACS32H_H = 0x04DF);
PROVIDE(OP2L = 0x04E0);
PROVIDE(OP2L_L = 0x04E0);
PROVIDE(OP2L_H = 0x04E1);
PROVIDE(OP2H = 0x04E2);
PROVIDE(OP2H_L = 0x04E2);
PROVIDE(OP2H_H = 0x04E3);
PROVIDE(RES0 = 0x04E4);
PROVIDE(RES0_L = 0x04E4);
PROVIDE(RES0_H = 0x04E5);
PROVIDE(RES1 = 0x04E6);
PROVIDE(RES1_L = 0x04E6);
PROVIDE(RES1_H = 0x04E7);
PROVIDE(RES2 = 0x04E8);
PROVIDE(RES2_L = 0x04E8);
PROVIDE(RES2_H = 0x04E9);
PROVIDE(RES3 = 0x04EA);
PROVIDE(RES3_L = 0x04EA);
PROVIDE(RES3_H = 0x04EB);
PROVIDE(MPY32CTL0 = 0x04EC);
PROVIDE(MPY32CTL0_L = 0x04EC);
PROVIDE(MPY32CTL0_H = 0x04ED);
/************************************************************
* PMM - Power Management System
************************************************************/
PROVIDE(PMMCTL0 = 0x0120);
PROVIDE(PMMCTL0_L = 0x0120);
PROVIDE(PMMCTL0_H = 0x0121);
PROVIDE(PMMIFG = 0x012A);
PROVIDE(PMMIFG_L = 0x012A);
PROVIDE(PMMIFG_H = 0x012B);
PROVIDE(PM5CTL0 = 0x0130);
PROVIDE(PM5CTL0_L = 0x0130);
PROVIDE(PM5CTL0_H = 0x0131);
/************************************************************
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
************************************************************/
PROVIDE(PAIN = 0x0200);
PROVIDE(PAIN_L = 0x0200);
PROVIDE(PAIN_H = 0x0201);
PROVIDE(PAOUT = 0x0202);
PROVIDE(PAOUT_L = 0x0202);
PROVIDE(PAOUT_H = 0x0203);
PROVIDE(PADIR = 0x0204);
PROVIDE(PADIR_L = 0x0204);
PROVIDE(PADIR_H = 0x0205);
PROVIDE(PAREN = 0x0206);
PROVIDE(PAREN_L = 0x0206);
PROVIDE(PAREN_H = 0x0207);
PROVIDE(PASEL0 = 0x020A);
PROVIDE(PASEL0_L = 0x020A);
PROVIDE(PASEL0_H = 0x020B);
PROVIDE(PASEL1 = 0x020C);
PROVIDE(PASEL1_L = 0x020C);
PROVIDE(PASEL1_H = 0x020D);
PROVIDE(PASELC = 0x0216);
PROVIDE(PASELC_L = 0x0216);
PROVIDE(PASELC_H = 0x0217);
PROVIDE(PAIES = 0x0218);
PROVIDE(PAIES_L = 0x0218);
PROVIDE(PAIES_H = 0x0219);
PROVIDE(PAIE = 0x021A);
PROVIDE(PAIE_L = 0x021A);
PROVIDE(PAIE_H = 0x021B);
PROVIDE(PAIFG = 0x021C);
PROVIDE(PAIFG_L = 0x021C);
PROVIDE(PAIFG_H = 0x021D);
PROVIDE(P1IV = 0x020E);
PROVIDE(P2IV = 0x021E);
/************************************************************
* DIGITAL I/O Port3/4 Pull up / Pull down Resistors
************************************************************/
PROVIDE(PBIN = 0x0220);
PROVIDE(PBIN_L = 0x0220);
PROVIDE(PBIN_H = 0x0221);
PROVIDE(PBOUT = 0x0222);
PROVIDE(PBOUT_L = 0x0222);
PROVIDE(PBOUT_H = 0x0223);
PROVIDE(PBDIR = 0x0224);
PROVIDE(PBDIR_L = 0x0224);
PROVIDE(PBDIR_H = 0x0225);
PROVIDE(PBREN = 0x0226);
PROVIDE(PBREN_L = 0x0226);
PROVIDE(PBREN_H = 0x0227);
PROVIDE(PBSEL0 = 0x022A);
PROVIDE(PBSEL0_L = 0x022A);
PROVIDE(PBSEL0_H = 0x022B);
PROVIDE(PBSEL1 = 0x022C);
PROVIDE(PBSEL1_L = 0x022C);
PROVIDE(PBSEL1_H = 0x022D);
PROVIDE(PBSELC = 0x0236);
PROVIDE(PBSELC_L = 0x0236);
PROVIDE(PBSELC_H = 0x0237);
PROVIDE(PBIES = 0x0238);
PROVIDE(PBIES_L = 0x0238);
PROVIDE(PBIES_H = 0x0239);
PROVIDE(PBIE = 0x023A);
PROVIDE(PBIE_L = 0x023A);
PROVIDE(PBIE_H = 0x023B);
PROVIDE(PBIFG = 0x023C);
PROVIDE(PBIFG_L = 0x023C);
PROVIDE(PBIFG_H = 0x023D);
PROVIDE(P3IV = 0x022E);
PROVIDE(P4IV = 0x023E);
/************************************************************
* DIGITAL I/O PortJ Pull up / Pull down Resistors
************************************************************/
PROVIDE(PJIN = 0x0320);
PROVIDE(PJIN_L = 0x0320);
PROVIDE(PJIN_H = 0x0321);
PROVIDE(PJOUT = 0x0322);
PROVIDE(PJOUT_L = 0x0322);
PROVIDE(PJOUT_H = 0x0323);
PROVIDE(PJDIR = 0x0324);
PROVIDE(PJDIR_L = 0x0324);
PROVIDE(PJDIR_H = 0x0325);
PROVIDE(PJREN = 0x0326);
PROVIDE(PJREN_L = 0x0326);
PROVIDE(PJREN_H = 0x0327);
PROVIDE(PJSEL0 = 0x032A);
PROVIDE(PJSEL0_L = 0x032A);
PROVIDE(PJSEL0_H = 0x032B);
PROVIDE(PJSEL1 = 0x032C);
PROVIDE(PJSEL1_L = 0x032C);
PROVIDE(PJSEL1_H = 0x032D);
PROVIDE(PJSELC = 0x0336);
PROVIDE(PJSELC_L = 0x0336);
PROVIDE(PJSELC_H = 0x0337);
/************************************************************
* Shared Reference
************************************************************/
PROVIDE(REFCTL0 = 0x01B0);
PROVIDE(REFCTL0_L = 0x01B0);
PROVIDE(REFCTL0_H = 0x01B1);
/************************************************************
* Real Time Clock
************************************************************/
PROVIDE(RTCCTL01 = 0x04A0);
PROVIDE(RTCCTL01_L = 0x04A0);
PROVIDE(RTCCTL01_H = 0x04A1);
PROVIDE(RTCCTL23 = 0x04A2);
PROVIDE(RTCCTL23_L = 0x04A2);
PROVIDE(RTCCTL23_H = 0x04A3);
PROVIDE(RTCPS0CTL = 0x04A8);
PROVIDE(RTCPS0CTL_L = 0x04A8);
PROVIDE(RTCPS0CTL_H = 0x04A9);
PROVIDE(RTCPS1CTL = 0x04AA);
PROVIDE(RTCPS1CTL_L = 0x04AA);
PROVIDE(RTCPS1CTL_H = 0x04AB);
PROVIDE(RTCPS = 0x04AC);
PROVIDE(RTCPS_L = 0x04AC);
PROVIDE(RTCPS_H = 0x04AD);
PROVIDE(RTCIV = 0x04AE);
PROVIDE(RTCTIM0 = 0x04B0);
PROVIDE(RTCTIM0_L = 0x04B0);
PROVIDE(RTCTIM0_H = 0x04B1);
PROVIDE(RTCTIM1 = 0x04B2);
PROVIDE(RTCTIM1_L = 0x04B2);
PROVIDE(RTCTIM1_H = 0x04B3);
PROVIDE(RTCDATE = 0x04B4);
PROVIDE(RTCDATE_L = 0x04B4);
PROVIDE(RTCDATE_H = 0x04B5);
PROVIDE(RTCYEAR = 0x04B6);
PROVIDE(RTCYEAR_L = 0x04B6);
PROVIDE(RTCYEAR_H = 0x04B7);
PROVIDE(RTCAMINHR = 0x04B8);
PROVIDE(RTCAMINHR_L = 0x04B8);
PROVIDE(RTCAMINHR_H = 0x04B9);
PROVIDE(RTCADOWDAY = 0x04BA);
PROVIDE(RTCADOWDAY_L = 0x04BA);
PROVIDE(RTCADOWDAY_H = 0x04BB);
PROVIDE(BIN2BCD = 0x04BC);
PROVIDE(BCD2BIN = 0x04BE);
/************************************************************
* SFR - Special Function Register Module
************************************************************/
PROVIDE(SFRIE1 = 0x0100);
PROVIDE(SFRIE1_L = 0x0100);
PROVIDE(SFRIE1_H = 0x0101);
PROVIDE(SFRIFG1 = 0x0102);
PROVIDE(SFRIFG1_L = 0x0102);
PROVIDE(SFRIFG1_H = 0x0103);
PROVIDE(SFRRPCR = 0x0104);
PROVIDE(SFRRPCR_L = 0x0104);
PROVIDE(SFRRPCR_H = 0x0105);
/************************************************************
* SYS - System Module
************************************************************/
PROVIDE(SYSCTL = 0x0180);
PROVIDE(SYSCTL_L = 0x0180);
PROVIDE(SYSCTL_H = 0x0181);
PROVIDE(SYSBSLC = 0x0182);
PROVIDE(SYSBSLC_L = 0x0182);
PROVIDE(SYSBSLC_H = 0x0183);
PROVIDE(SYSJMBC = 0x0186);
PROVIDE(SYSJMBC_L = 0x0186);
PROVIDE(SYSJMBC_H = 0x0187);
PROVIDE(SYSJMBI0 = 0x0188);
PROVIDE(SYSJMBI0_L = 0x0188);
PROVIDE(SYSJMBI0_H = 0x0189);
PROVIDE(SYSJMBI1 = 0x018A);
PROVIDE(SYSJMBI1_L = 0x018A);
PROVIDE(SYSJMBI1_H = 0x018B);
PROVIDE(SYSJMBO0 = 0x018C);
PROVIDE(SYSJMBO0_L = 0x018C);
PROVIDE(SYSJMBO0_H = 0x018D);
PROVIDE(SYSJMBO1 = 0x018E);
PROVIDE(SYSJMBO1_L = 0x018E);
PROVIDE(SYSJMBO1_H = 0x018F);
PROVIDE(SYSBERRIV = 0x0198);
PROVIDE(SYSBERRIV_L = 0x0198);
PROVIDE(SYSBERRIV_H = 0x0199);
PROVIDE(SYSUNIV = 0x019A);
PROVIDE(SYSUNIV_L = 0x019A);
PROVIDE(SYSUNIV_H = 0x019B);
PROVIDE(SYSSNIV = 0x019C);
PROVIDE(SYSSNIV_L = 0x019C);
PROVIDE(SYSSNIV_H = 0x019D);
PROVIDE(SYSRSTIV = 0x019E);
PROVIDE(SYSRSTIV_L = 0x019E);
PROVIDE(SYSRSTIV_H = 0x019F);
/************************************************************
* Timer0_A3
************************************************************/
PROVIDE(TA0CTL = 0x0340);
PROVIDE(TA0CCTL0 = 0x0342);
PROVIDE(TA0CCTL1 = 0x0344);
PROVIDE(TA0CCTL2 = 0x0346);
PROVIDE(TA0R = 0x0350);
PROVIDE(TA0CCR0 = 0x0352);
PROVIDE(TA0CCR1 = 0x0354);
PROVIDE(TA0CCR2 = 0x0356);
PROVIDE(TA0IV = 0x036E);
PROVIDE(TA0EX0 = 0x0360);
/************************************************************
* Timer1_A3
************************************************************/
PROVIDE(TA1CTL = 0x0380);
PROVIDE(TA1CCTL0 = 0x0382);
PROVIDE(TA1CCTL1 = 0x0384);
PROVIDE(TA1CCTL2 = 0x0386);
PROVIDE(TA1R = 0x0390);
PROVIDE(TA1CCR0 = 0x0392);
PROVIDE(TA1CCR1 = 0x0394);
PROVIDE(TA1CCR2 = 0x0396);
PROVIDE(TA1IV = 0x03AE);
PROVIDE(TA1EX0 = 0x03A0);
/************************************************************
* Timer0_B3
************************************************************/
PROVIDE(TB0CTL = 0x03C0);
PROVIDE(TB0CCTL0 = 0x03C2);
PROVIDE(TB0CCTL1 = 0x03C4);
PROVIDE(TB0CCTL2 = 0x03C6);
PROVIDE(TB0R = 0x03D0);
PROVIDE(TB0CCR0 = 0x03D2);
PROVIDE(TB0CCR1 = 0x03D4);
PROVIDE(TB0CCR2 = 0x03D6);
PROVIDE(TB0EX0 = 0x03E0);
PROVIDE(TB0IV = 0x03EE);
/************************************************************
* Timer1_B3
************************************************************/
PROVIDE(TB1CTL = 0x0400);
PROVIDE(TB1CCTL0 = 0x0402);
PROVIDE(TB1CCTL1 = 0x0404);
PROVIDE(TB1CCTL2 = 0x0406);
PROVIDE(TB1R = 0x0410);
PROVIDE(TB1CCR0 = 0x0412);
PROVIDE(TB1CCR1 = 0x0414);
PROVIDE(TB1CCR2 = 0x0416);
PROVIDE(TB1IV = 0x042E);
PROVIDE(TB1EX0 = 0x0420);
/************************************************************
* Timer2_B3
************************************************************/
PROVIDE(TB2CTL = 0x0440);
PROVIDE(TB2CCTL0 = 0x0442);
PROVIDE(TB2CCTL1 = 0x0444);
PROVIDE(TB2CCTL2 = 0x0446);
PROVIDE(TB2R = 0x0450);
PROVIDE(TB2CCR0 = 0x0452);
PROVIDE(TB2CCR1 = 0x0454);
PROVIDE(TB2CCR2 = 0x0456);
PROVIDE(TB2IV = 0x046E);
PROVIDE(TB2EX0 = 0x0460);
/************************************************************
* USCI A0
************************************************************/
PROVIDE(UCA0CTLW0 = 0x05C0);
PROVIDE(UCA0CTLW0_L = 0x05C0);
PROVIDE(UCA0CTLW0_H = 0x05C1);
PROVIDE(UCA0CTLW1 = 0x05C2);
PROVIDE(UCA0CTLW1_L = 0x05C2);
PROVIDE(UCA0CTLW1_H = 0x05C3);
PROVIDE(UCA0BRW = 0x05C6);
PROVIDE(UCA0BRW_L = 0x05C6);
PROVIDE(UCA0BRW_H = 0x05C7);
PROVIDE(UCA0MCTLW = 0x05C8);
PROVIDE(UCA0MCTLW_L = 0x05C8);
PROVIDE(UCA0MCTLW_H = 0x05C9);
PROVIDE(UCA0STATW = 0x05CA);
PROVIDE(UCA0RXBUF = 0x05CC);
PROVIDE(UCA0RXBUF_L = 0x05CC);
PROVIDE(UCA0RXBUF_H = 0x05CD);
PROVIDE(UCA0TXBUF = 0x05CE);
PROVIDE(UCA0TXBUF_L = 0x05CE);
PROVIDE(UCA0TXBUF_H = 0x05CF);
PROVIDE(UCA0ABCTL = 0x05D0);
PROVIDE(UCA0IRCTL = 0x05D2);
PROVIDE(UCA0IRCTL_L = 0x05D2);
PROVIDE(UCA0IRCTL_H = 0x05D3);
PROVIDE(UCA0IE = 0x05DA);
PROVIDE(UCA0IE_L = 0x05DA);
PROVIDE(UCA0IE_H = 0x05DB);
PROVIDE(UCA0IFG = 0x05DC);
PROVIDE(UCA0IFG_L = 0x05DC);
PROVIDE(UCA0IFG_H = 0x05DD);
PROVIDE(UCA0IV = 0x05DE);
/************************************************************
* USCI B0
************************************************************/
PROVIDE(UCB0CTLW0 = 0x0640);
PROVIDE(UCB0CTLW0_L = 0x0640);
PROVIDE(UCB0CTLW0_H = 0x0641);
PROVIDE(UCB0CTLW1 = 0x0642);
PROVIDE(UCB0CTLW1_L = 0x0642);
PROVIDE(UCB0CTLW1_H = 0x0643);
PROVIDE(UCB0BRW = 0x0646);
PROVIDE(UCB0BRW_L = 0x0646);
PROVIDE(UCB0BRW_H = 0x0647);
PROVIDE(UCB0STATW = 0x0648);
PROVIDE(UCB0STATW_L = 0x0648);
PROVIDE(UCB0STATW_H = 0x0649);
PROVIDE(UCB0TBCNT = 0x064A);
PROVIDE(UCB0TBCNT_L = 0x064A);
PROVIDE(UCB0TBCNT_H = 0x064B);
PROVIDE(UCB0RXBUF = 0x064C);
PROVIDE(UCB0RXBUF_L = 0x064C);
PROVIDE(UCB0RXBUF_H = 0x064D);
PROVIDE(UCB0TXBUF = 0x064E);
PROVIDE(UCB0TXBUF_L = 0x064E);
PROVIDE(UCB0TXBUF_H = 0x064F);
PROVIDE(UCB0I2COA0 = 0x0654);
PROVIDE(UCB0I2COA0_L = 0x0654);
PROVIDE(UCB0I2COA0_H = 0x0655);
PROVIDE(UCB0I2COA1 = 0x0656);
PROVIDE(UCB0I2COA1_L = 0x0656);
PROVIDE(UCB0I2COA1_H = 0x0657);
PROVIDE(UCB0I2COA2 = 0x0658);
PROVIDE(UCB0I2COA2_L = 0x0658);
PROVIDE(UCB0I2COA2_H = 0x0659);
PROVIDE(UCB0I2COA3 = 0x065A);
PROVIDE(UCB0I2COA3_L = 0x065A);
PROVIDE(UCB0I2COA3_H = 0x065B);
PROVIDE(UCB0ADDRX = 0x065C);
PROVIDE(UCB0ADDRX_L = 0x065C);
PROVIDE(UCB0ADDRX_H = 0x065D);
PROVIDE(UCB0ADDMASK = 0x065E);
PROVIDE(UCB0ADDMASK_L = 0x065E);
PROVIDE(UCB0ADDMASK_H = 0x065F);
PROVIDE(UCB0I2CSA = 0x0660);
PROVIDE(UCB0I2CSA_L = 0x0660);
PROVIDE(UCB0I2CSA_H = 0x0661);
PROVIDE(UCB0IE = 0x066A);
PROVIDE(UCB0IE_L = 0x066A);
PROVIDE(UCB0IE_H = 0x066B);
PROVIDE(UCB0IFG = 0x066C);
PROVIDE(UCB0IFG_L = 0x066C);
PROVIDE(UCB0IFG_H = 0x066D);
PROVIDE(UCB0IV = 0x066E);
/************************************************************
* USCI A1
************************************************************/
PROVIDE(UCA1CTLW0 = 0x05E0);
PROVIDE(UCA1CTLW0_L = 0x05E0);
PROVIDE(UCA1CTLW0_H = 0x05E1);
PROVIDE(UCA1CTLW1 = 0x05E2);
PROVIDE(UCA1CTLW1_L = 0x05E2);
PROVIDE(UCA1CTLW1_H = 0x05E3);
PROVIDE(UCA1BRW = 0x05E6);
PROVIDE(UCA1BRW_L = 0x05E6);
PROVIDE(UCA1BRW_H = 0x05E7);
PROVIDE(UCA1MCTLW = 0x05E8);
PROVIDE(UCA1MCTLW_L = 0x05E8);
PROVIDE(UCA1MCTLW_H = 0x05E9);
PROVIDE(UCA1STATW = 0x05EA);
PROVIDE(UCA1RXBUF = 0x05EC);
PROVIDE(UCA1RXBUF_L = 0x05EC);
PROVIDE(UCA1RXBUF_H = 0x05ED);
PROVIDE(UCA1TXBUF = 0x05EE);
PROVIDE(UCA1TXBUF_L = 0x05EE);
PROVIDE(UCA1TXBUF_H = 0x05EF);
PROVIDE(UCA1ABCTL = 0x05F0);
PROVIDE(UCA1IRCTL = 0x05F2);
PROVIDE(UCA1IRCTL_L = 0x05F2);
PROVIDE(UCA1IRCTL_H = 0x05F3);
PROVIDE(UCA1IE = 0x05FA);
PROVIDE(UCA1IE_L = 0x05FA);
PROVIDE(UCA1IE_H = 0x05FB);
PROVIDE(UCA1IFG = 0x05FC);
PROVIDE(UCA1IFG_L = 0x05FC);
PROVIDE(UCA1IFG_H = 0x05FD);
PROVIDE(UCA1IV = 0x05FE);
/************************************************************
* WATCHDOG TIMER A
************************************************************/
PROVIDE(WDTCTL = 0x015C);
PROVIDE(WDTCTL_L = 0x015C);
PROVIDE(WDTCTL_H = 0x015D);
/************************************************************
* Interrupt Vectors (offset from 0xFF80 + 0x10 for Password)
************************************************************/
/************************************************************
* End of Modules
************************************************************/
[-- Attachment #1.1.4: gpio.c --]
[-- Type: text/x-csrc, Size: 162 bytes --]
#include <msp430.h>
void main(void) {
WDTCTL = WDTPW | WDTHOLD;
P3DIR = BIT4;
P3OUT &= ~BIT4;
while(1) {
__delay_cycles(2500000);
P3OUT ^= BIT4;
}
}
[-- Attachment #1.1.5: Makefile --]
[-- Type: text/plain, Size: 631 bytes --]
MCU ?= msp430fr5739
PROG ?= rf2500
ELF ?= binary.elf
SRC := $(wildcard *.c)
OBJ := $(SRC:%.c=%.o)
CROSS_COMPILE ?= msp430-elf-
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
AS := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)gcc
SIZE := $(CROSS_COMPILE)size
CFLAGS := -mmcu=$(MCU) -Wall -Wno-main -Werror -ffunction-sections -fdata-sections -Os
ASFLAGS := -mmcu=$(MCU)
LDFLAGS := -mmcu=$(MCU) -Wl,--gc-sections
.PHONY: all clean prog
all: $(ELF)
$(SIZE) $(ELF)
clean:
-rm -f $(OBJ) $(ELF)
prog: $(ELF)
mspdebug $(PROG) "prog $(ELF)"
$(ELF): $(OBJ)
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
[-- Attachment #1.1.6: binary.elf --]
[-- Type: application/octet-stream, Size: 3564 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: RWX load segment MSP430 back-end
2023-01-18 16:31 RWX load segment MSP430 back-end Orlando Arias
@ 2023-01-19 11:45 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2023-01-19 11:45 UTC (permalink / raw)
To: Orlando Arias, binutils
Hi Orlando,
> I ran into a rather puzzling issue with ld.bfd for the MSP430 target
For problems like this it is really best if you can file a bug report
with the binutils bugzilla system. That way, if there is an issue,
we can track it, and future readers can search for the solution.
> /usr/bin/msp430-elf-ld: warning: binary.elf has a LOAD segment with RWX permissions
> $ msp430-elf-readelf -l binary.elf
> Program Headers:
> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> LOAD 0x000000 0x0000c14c 0x0000c14c 0x0016e 0x0016e RWE 0x4
If you add the -S option to the msp430-elf-readelf command, it will also
tell you which sections are mapped to that segment:
Section to Segment mapping:
Segment Sections...
00 .rodata2 .text
> Well, indeed there is something that gets placed at 0xc14c that is read write and executable. However, the MSP430FR5739 has nothing on that memory region! In fact, looking
> at the linker scripts reveals nothing that should be placed there, unless I am missing something of course.
This does assume that the linker script for the msp430fr5397 has been used.
It is possible that a different script it being used. Adding -v to the
final msp43-elf-gcc command line should you check that.
Even better if you add -Wl,-Map,binary.map the linker will create a map file
(called binary.map) which will show you what went where during the link.
> In any case, I have no idea where extraneous segment is coming from.
My best guess is that the segment is meant to map onto the FRAM of the
MSP430FR5739. But for some reason the segment's start address is being
pushed backwards to earlier in memory. No idea why.
> I did notice that a patch was submitted to treat the cris*-elf backend in a special way by defaulting to --no-warn-rwx-segment which I
> guess could be done as well for the MSP430.
That could be done. But it is only a warning message - it should not
affect the outcome of the link at all. (I should also note that there
is a configure-time option to disable this warning, so it is possible
to build a msp430-elf-ld which does not warn, without adding any patches
to the binutils sources).
Of course if your programs are working, then you can safely ignore this
issue. (Assuming that there are no security concerns over the writeable,
executable memory). You can always add -Wl,--no-warn-rwx-segment to the
gcc command line if you want to turn off the warning. If you are worried
however then please refile this email as a bug report, and if you can,
include a copy of the linker map and linker script.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-19 11:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 16:31 RWX load segment MSP430 back-end Orlando Arias
2023-01-19 11:45 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).