示例#1
0
                str(flash_page_size))
    if board.chip["family"] == "ESP8266":
        codeOut("#define FLASH_START                     " + hex(0x0))
    elif board.chip["family"] == "NRF52" or board.chip["family"] == "NRF51":
        codeOut("#define FLASH_START                     " + hex(0x0))
    elif board.chip["class"] == "EFM32":
        codeOut(
            "#define FLASH_START                     FLASH_BASE // FLASH_BASE defined in em_device.h"
        )
    else:
        codeOut("#define FLASH_START                     " + hex(0x08000000))
    if has_bootloader:
        codeOut("#define BOOTLOADER_SIZE                 " +
                str(common.get_bootloader_size(board)))
        codeOut("#define ESPRUINO_BINARY_ADDRESS         " +
                hex(common.get_espruino_binary_address(board)))
    codeOut("")
    codeOut("#define FLASH_SAVED_CODE_START            " +
            str(flash_saved_code_start))
    codeOut("#define FLASH_SAVED_CODE_LENGTH           " +
            str(int(flash_page_size * flash_saved_code_pages)))
    codeOut(
        "#define FLASH_MAGIC_LOCATION              (FLASH_SAVED_CODE_START + FLASH_SAVED_CODE_LENGTH - 4)"
    )
    codeOut("#define FLASH_MAGIC 0xDEADBEEF")
codeOut("")
codeOut("#define USART_COUNT                          " +
        str(board.chip["usart"]))
codeOut("#define SPI_COUNT                            " +
        str(board.chip["spi"]))
codeOut("#define I2C_COUNT                            " +
示例#2
0
#   64k at 0x10000000
if board.chip["part"].startswith("STM32L496") and RAM_SIZE > 256*1024:
  RAM_SIZE = 256*1024

# IS_BOOTLOADER will only get used on official Espruino
# boards. The ST discovery bootloader rejects firmwares that
# aren't based at 0x08000000, however it seems to be wrong. If you use
# DFU then the built-in DFU bootloader will fail to load
# the firmware on reboot if FLASH_BASE is 0x08000000, but
# will work if it's 0x00000000
if IS_BOOTLOADER:
  FLASH_SIZE = BOOTLOADER_SIZE
  FLASH_BASE = 0x00000000

elif IS_USING_BOOTLOADER:
  FLASH_BASE = common.get_espruino_binary_address(board)
  FLASH_SIZE -= BOOTLOADER_SIZE

STACK_START = RAM_BASE + RAM_SIZE

codeOut("""
/* Automatically generated linker file for """+boardname+"""
   Generated by scripts/build_linker.py

ENTRY(Reset_Handler)

/* Highest stack address */
_estack = """+hex(STACK_START)+""";

MEMORY
{
示例#3
0
  codeOut("#define FLASH_AVAILABLE_FOR_CODE        "+str(int(flash_available_for_code)))
  if board.chip["class"]=="EFM32":
    codeOut("// FLASH_PAGE_SIZE defined in em_device.h");
  else:
    codeOut("#define FLASH_PAGE_SIZE                 "+str(flash_page_size))
  if board.chip["family"]=="ESP8266":
    codeOut("#define FLASH_START                     "+hex(0x0))
  elif board.chip["family"]=="NRF52" or board.chip["family"]=="NRF51":
    codeOut("#define FLASH_START                     "+hex(0x0))
  elif board.chip["class"]=="EFM32":
    codeOut("#define FLASH_START                     FLASH_BASE // FLASH_BASE defined in em_device.h")
  else:
    codeOut("#define FLASH_START                     "+hex(0x08000000))
  if has_bootloader:
    codeOut("#define BOOTLOADER_SIZE                 "+str(common.get_bootloader_size(board)))
    codeOut("#define ESPRUINO_BINARY_ADDRESS         "+hex(common.get_espruino_binary_address(board)))
  codeOut("")


codeOut("#define FLASH_SAVED_CODE_START            "+str(flash_saved_code_start))
codeOut("#define FLASH_SAVED_CODE_LENGTH           "+str(int(flash_page_size*flash_saved_code_pages)))
codeOut("");

codeOut("#define CLOCK_SPEED_MHZ                      "+str(board.chip["speed"]))
codeOut("#define USART_COUNT                          "+str(board.chip["usart"]))
codeOut("#define SPI_COUNT                            "+str(board.chip["spi"]))
codeOut("#define I2C_COUNT                            "+str(board.chip["i2c"]))
codeOut("#define ADC_COUNT                            "+str(board.chip["adc"]))
codeOut("#define DAC_COUNT                            "+str(board.chip["dac"]))
codeOut("#define EXTI_COUNT                           "+str(exti_count))
codeOut("");
示例#4
0
# -----------------------------------------------------------------------------------------
BOOTLOADER_SIZE = common.get_bootloader_size(board)
RAM_BASE = 0x20000000
FLASH_BASE = 0x00000000
RAM_SIZE = board.chip["ram"] * 1024
FLASH_SIZE = board.chip["flash"] * 1024

# Beware - on some devices (the STM32F4) the memory is divided into two non-continuous blocks
if board.chip["family"] == "STM32F4" and RAM_SIZE > 128 * 1204:
    RAM_SIZE = 128 * 1024

if IS_BOOTLOADER:
    FLASH_SIZE = BOOTLOADER_SIZE
elif IS_USING_BOOTLOADER:
    FLASH_BASE = common.get_espruino_binary_address(board)
    FLASH_SIZE -= BOOTLOADER_SIZE

STACK_START = RAM_BASE + RAM_SIZE

codeOut("""
/* Automatically generated linker file for """ + boardname + """
   Generated by scripts/build_linker.py

ENTRY(Reset_Handler)

/* Highest stack address */
_estack = """ + hex(STACK_START) + """;

MEMORY
{