cargo-forge 0.1.5

An interactive Rust project generator with templates and common features
/* Linker script for {{ chip | default(value="STM32F401RETx") }} */
/* NOTE: Modify these values to match your specific microcontroller */

MEMORY
{
  /* Flash memory starts at 0x08000000 and has a size determined by the chip variant */
  {% if target == "thumbv7em-none-eabihf" %}
  /* STM32F4xx series - adjust based on specific chip */
  FLASH : ORIGIN = 0x08000000, LENGTH = {{ flash_size | default(value="512K") }}
  RAM : ORIGIN = 0x20000000, LENGTH = {{ ram_size | default(value="96K") }}
  {% elif target == "thumbv6m-none-eabi" %}
  /* STM32F1xx series - adjust based on specific chip */
  FLASH : ORIGIN = 0x08000000, LENGTH = {{ flash_size | default(value="64K") }}
  RAM : ORIGIN = 0x20000000, LENGTH = {{ ram_size | default(value="20K") }}
  {% elif target == "thumbv7m-none-eabi" %}
  /* STM32F1xx series - adjust based on specific chip */
  FLASH : ORIGIN = 0x08000000, LENGTH = {{ flash_size | default(value="128K") }}
  RAM : ORIGIN = 0x20000000, LENGTH = {{ ram_size | default(value="20K") }}
  {% else %}
  /* Generic ARM Cortex-M - adjust based on your microcontroller */
  FLASH : ORIGIN = 0x08000000, LENGTH = 256K
  RAM : ORIGIN = 0x20000000, LENGTH = 64K
  {% endif %}
}

/* This is where the call stack will be allocated. */
/* The stack is of the full descending type. */
/* You may want to use this variable to locate the call stack and static
   variables in different memory regions. Below is shown the default value */
/* _stack_start = ORIGIN(RAM) + LENGTH(RAM); */

/* You can use this symbol to customize the location of the .text section */
/* If omitted the .text section will be placed right after the .vector_table
   section */
/* This can be useful for microcontrollers with multiple Flash memory banks */
/* _stext = ORIGIN(FLASH) + 0x400; */

/* Example of putting non-critical functions into RAM
 * Note: This requires enabling the appropriate Cargo features and careful
 * memory management in your application code
 */
/* _ram_start = ORIGIN(RAM);
   _ram_end = ORIGIN(RAM) + LENGTH(RAM); */