Commit 928c0b92 authored by Alexander Potashev's avatar Alexander Potashev

RT77744. arm_cortexm3: Add configuration option CONFIG_ARMCORTEXM3_RAMCODE

 * Simplify source code.
 * Let us completely disable the `.ramcode` section for the MCUs to be supported
in the future, e.g. LPC43xx and LPC18xx.

This change does not make usage of the `.ramcode` section optional.
parent 065d7e55
......@@ -45,9 +45,12 @@ extern char _mem_ram_buf_base, _mem_ram_buf_size;
* this function to be inlined into do_cptf(), which is located in flash.
* This makes the U-Boot crash while performing self-upgrade.
*/
int __attribute__((section(".ramcode")))
__attribute__ ((long_call))
envm_write_and_reset(ulong dst, ulong src, ulong size, int do_reset)
int
#ifdef CONFIG_ARMCORTEXM3_RAMCODE
__attribute__((section(".ramcode")))
__attribute__((long_call))
#endif
envm_write_and_reset(ulong dst, ulong src, ulong size, int do_reset)
{
int ret = 0;
......
......@@ -110,9 +110,12 @@ void hw_watchdog_reset(void)
* Note that we need for this function to reside in RAM since it
* can be used to self-upgrade U-boot in eNMV.
*/
void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
reset_cpu(ulong addr)
void
#ifdef CONFIG_ARMCORTEXM3_RAMCODE
__attribute__((section(".ramcode")))
__attribute__((long_call))
#endif
reset_cpu(ulong addr)
{
#ifdef CONFIG_SYS_LPC178X
/*
......
......@@ -20,6 +20,8 @@
#ifndef __ENVM_H__
#define __ENVM_H__
#include <common.h>
/*
* Initialize the eNVM interface
*/
......@@ -31,8 +33,10 @@ void envm_init(void);
* will be used to self-upgrade U-boot in eNMV.
*/
unsigned int
#ifdef CONFIG_ARMCORTEXM3_RAMCODE
__attribute__((section(".ramcode")))
__attribute__ ((long_call))
__attribute__((long_call))
#endif
envm_write(unsigned int offset, void * buf, unsigned int size);
#if defined(CONFIG_SYS_STM32)
......
......@@ -473,9 +473,21 @@ int checkicache (void);
int checkdcache (void);
void upmconfig (unsigned int, unsigned int *, unsigned int);
ulong get_tbclk (void);
void
/*
* The following MCUs should use the .ramcode section to allow for self-upgrade
*
* The LPC18xx/LPC43xx MCUs (CONFIG_SYS_LPC18XX) normally do not use
* execution-in-place. But if they do, the CONFIG_ARMCORTEXM3_RAMCODE option
* can be defined in the U-Boot board configuration file (include/configs/.h)
*/
#if defined(CONFIG_SYS_A2F) || defined(CONFIG_SYS_STM32) || \
defined(CONFIG_SYS_LPC178X) || defined(CONFIG_SYS_KINETIS)
#define CONFIG_ARMCORTEXM3_RAMCODE
#endif
void
#ifdef CONFIG_ARMCORTEXM3_RAMCODE
__attribute__((section(".ramcode")))
__attribute__ ((long_call))
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment