PSoC 4 Peripheral Driver Library - Alpha
Startup (System Configuration Files)

General Description

Provides device startup, system configuration, and linker script files.

The system startup provides the followings features:

Configuration Considerations

Device Memory Definition

The flash and RAM allocation is defined by the linker scripts.

Note
The linker files provided with the PDL are generic and handle all common use cases. Your project may not use every section defined in the linker files. In that case you may see warnings during the build process. To eliminate build warnings in your project, you can simply comment out or remove the relevant code in the linker file.

ARM GCC
The flash and RAM sections for the CPU are defined in the linker file: for example, 'cy8c4xx5.ld'.

Change the flash and RAM sizes by editing the macros value in the linker file:

__FLASH_START = 0x00000000;
__FLASH_SIZE = 0x00008000;
__RAM_START = 0x20000000;
__RAM_SIZE = 0x00001000;

ARM MDK
The flash and RAM sections for the CPU are defined in the linker file: for example, 'cy8c4xx5.sct'.

Note
The linker files provided with the PDL are generic and handle all common use cases. Your project may not use every section defined in the linker file. In that case you may see the warnings during the build process: L6314W (no section matches pattern) and/or L6329W (pattern only matches removed unused sections). In your project, you can suppress the warning by passing the "--diag_suppress=L6314W,L6329W" option to the linker. You can also comment out or remove the relevant code in the linker file.

Change the flash and RAM sizes by editing the macros value in the linker file:

#define __FLASH_START 0x00000000
#define __FLASH_SIZE 0x00008000
#define __RAM_START 0x20000000
#define __RAM_SIZE 0x00001000

IAR
The flash and RAM sections for the CPU are defined in the linker files: for example, 'cy8c4xx5.icf'.

Change the flash and RAM sizes by editing the macros value in the linker file:

define symbol __ICFEDIT_region_IROM1_start__ = 0x00000000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x00007FFF;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x20000000;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x20000FFF;

Device Initialization

After a power-on-reset (POR), the boot process is handled by the boot code from the on-chip ROM that is always executed by the core. The boot code passes the control to the startup code located in flash.

The startup code performs the device initialization by a call to Reset_Handler(), which calls SystemInit(), and then calls the CMSIS-defined __PROGRAM_START().

Heap and Stack Configuration

The heap and stack configurations are defined by the linker scripts.

By default, the stack size is set to 0x0000400 and the heap size is allocated dynamically to the whole available free memory up to stack memory and it is set to the 0x00000080 (for ARM GCC and IAR compilers) as minimal value.

Change the heap and stack sizes by editing the macros value in the linker file: ARM GCC

__STACK_SIZE = 0x00000400;
__HEAP_SIZE = 0x00000080;

ARM MDK

#define __STACK_SIZE 0x00000400
#define __HEAP_SIZE 0x00000080

IAR

define symbol __ICFEDIT_size_cstack__ = 0x0400;
define symbol __ICFEDIT_size_heap__ = 0x0080;

Default Interrupt Handlers Definition

The default interrupt handler functions are defined as weak functions to a dummy handler in the startup file. The naming convention for the interrupt handler names is <interrupt_name>_IRQHandler. A default interrupt handler can be overwritten in user code by defining the handler function using the same name. For example:

void scb_0_interrupt_IRQHandler(void)
{
...
}

Vectors Table Copy from Flash to RAM

This process uses memory sections defined in the linker script. The vector table address (and the vector table itself) is defined in the startup files (e.g. startup_psoc4100sp.c). The code in these files defines the Reset_Handler, represents __VECTOR_TABLE as vector table in Flash and __RAM_VECTOR_TABLE represents this table in RAM.
The vector table is copied from Flash to RAM in Reset_Handler using memcpy().

MISRA-C Compliance

The startup driver has the following specific deviations:

MISRA Rule Rule Class (Required/Advisory) Rule Description Description of Deviation(s)
20.1 A #include directives should only be preceded by preprocessor directives or comments. The include directives are in generated files. These files should not be changed manually.

Changelog

Version Changes Reason for Change
1.0 Initial version

API Reference

 Functions
 
 Global Variables