Wednesday, February 21st 2018, 12:26am UTC+1

You are not logged in.

  • Login
  • Register

markuskrug

Beginner

Date of registration: Oct 19th 2016

Posts: 17

1

Wednesday, January 3rd 2018, 10:08am

[SOLVED] possible missing code in thumb_crt0.s if using TCM

Dear all,

I played around with TCM on a SAME70 device. After a while I get it to work. During my experiments I came across the point to copy function code from the internal flash to the TCM memory. According to the Application Note AN44047 from Atmel/Microchip this needs to be done after the GPNVM bits are set according to the size of TCM memory you are requesting and after enabling the TCM in the System Control Block register.
If you setup a project for a SAME70 device the thumb_crt0.s contains already the part for copying code and data to the corresponding TCM memory areas. It is covered by a ifdefine (INITIALIZE_TCM_SECTIONS) so it can be activated easily. However, the part for setting the GPNVM bits and enabling TCM is missing. For me that makes not much sense. Anyone has any suggestions?

Best Regards
Markus

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 377

2

Thursday, January 4th 2018, 11:16am

Hi Markus,

The crt0 is the generic memory initialization that is independent from hardware.

Before _start is called, the Reset_Handler will call system initialization, and, if defined, memory initialization.
This is the target-specific part where you can enable and configure TCM.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Reset_Handler:
#ifndef NO_STACK_INIT
  /* Initialise main stack */
  ldr r0, =STACK_INIT_VAL
  bic r0, #0x7
  mov sp, r0
#endif
#ifndef NO_SYSTEM_INIT
  /* Initialise system */
  ldr r0, =SystemInit
  blx r0
#endif

#ifdef MEMORY_INIT
  ldr r0, =MemoryInit
  blx r0
#endif


Regards
Johannes