mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
Merge #19751
19751: cpu/avr8 common: added avr4.ld script r=maribu a=hugueslarrive ### Contribution description Splitted from: - #19740 ### Testing procedure Tested on atmega8 with: - #19755 ### Issues/PRs references Co-authored-by: Hugues Larrive <hlarrive@pm.me>
This commit is contained in:
commit
d4a8c145a8
27
cpu/avr8_common/ldscripts/avr4.ld
Normal file
27
cpu/avr8_common/ldscripts/avr4.ld
Normal file
@ -0,0 +1,27 @@
|
||||
/* Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
Copying and distribution of this script, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:4)
|
||||
|
||||
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 8K;
|
||||
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0;
|
||||
__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
|
||||
__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
|
||||
__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
|
||||
__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
|
||||
__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = __DATA_REGION_LENGTH__
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
|
||||
fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
|
||||
lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
|
||||
signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
|
||||
user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
|
||||
}
|
||||
|
||||
INCLUDE avr_common.ld
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2021 Gerson Fernando Budke
|
||||
* 2023 Hugues Larrive
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
@ -18,6 +19,7 @@
|
||||
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
||||
* @author Steffen Robertz <steffen.robertz@rwth-aachen.de>
|
||||
* @author Gerson Fernando Budke <nandojve@gmail.com>
|
||||
* @author Hugues Larrive <hugues.larrive@pm.me>
|
||||
* @}
|
||||
*/
|
||||
|
||||
@ -48,7 +50,7 @@ extern void __libc_init_array(void);
|
||||
* avr-libc normally uses the .init9 section for a call to main. This call
|
||||
* seems to be not replaceable without hacking inside the library. We
|
||||
* circumvent the call to main by using section .init7 to call the function
|
||||
* reset_handler which therefore is the real entry point and section .init8
|
||||
* reset_handler which therefore is the real entry point and section .init8
|
||||
* which should never be reached but just in case jumps to exit.
|
||||
* This way there should be no way to call main directly.
|
||||
*/
|
||||
@ -57,12 +59,20 @@ void init8_ovr(void) __attribute__((section(".init8")));
|
||||
|
||||
__attribute__((used, naked)) void init7_ovr(void)
|
||||
{
|
||||
#if (FLASHEND <= 0x1FFF)
|
||||
__asm__ ("rjmp reset_handler");
|
||||
#else
|
||||
__asm__ ("call reset_handler");
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((used, naked)) void init8_ovr(void)
|
||||
{
|
||||
#if (FLASHEND <= 0x1FFF)
|
||||
__asm__ ("rjmp exit");
|
||||
#else
|
||||
__asm__ ("jmp exit");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user