I can compile the following code ("main.cpp") with the original linker script provided by pjrc and run it on Teensy 4.1 module without any issue.
-----------------------
[ mail.cpp file ]
#include <Arduino.h>
extern "C" int main(void)
{
// To use Teensy 4.0 without Arduino, simply put your code here.
// For example:
pinMode(13, OUTPUT);
while (1) {
digitalWriteFast(13, HIGH);
delay(500);
digitalWriteFast(13, LOW);
delay(500);
}
}
-------------------
I want to change the original linker script in imxrt1062_t41.ld to the following, in order to to use the different regions of FLASH and TCM. Any of those changes will cause the Teensy 4.1 module to not booting up. The code compiles OK and the map file reflects the changes as well.
Question: What else do I need to change in the code in order to have the ResetHandler() (in startup.c and my guess this is where everything starts) prepare the system correctly in order to run the main()?
--------------------
[ only part of the modified region of the file imxrt1062_t41.ld ]
MEMORY
{
ITCM (rwx): ORIGIN = 0x00040000, LENGTH = 256K
DTCM (rwx): ORIGIN = 0x20040000, LENGTH = 256K
RAM (rwx): ORIGIN = 0x20240000, LENGTH = 256K /* RAM change alone will not cause problem */
FLASH (rwx): ORIGIN = 0x60064000, LENGTH = 6000K
ERAM (rwx): ORIGIN = 0x70000000, LENGTH = 16384K
}
...
[reset of the linker script not changed]
---------------------
Thanks,
Jian
-----------------------
[ mail.cpp file ]
#include <Arduino.h>
extern "C" int main(void)
{
// To use Teensy 4.0 without Arduino, simply put your code here.
// For example:
pinMode(13, OUTPUT);
while (1) {
digitalWriteFast(13, HIGH);
delay(500);
digitalWriteFast(13, LOW);
delay(500);
}
}
-------------------
I want to change the original linker script in imxrt1062_t41.ld to the following, in order to to use the different regions of FLASH and TCM. Any of those changes will cause the Teensy 4.1 module to not booting up. The code compiles OK and the map file reflects the changes as well.
Question: What else do I need to change in the code in order to have the ResetHandler() (in startup.c and my guess this is where everything starts) prepare the system correctly in order to run the main()?
--------------------
[ only part of the modified region of the file imxrt1062_t41.ld ]
MEMORY
{
ITCM (rwx): ORIGIN = 0x00040000, LENGTH = 256K
DTCM (rwx): ORIGIN = 0x20040000, LENGTH = 256K
RAM (rwx): ORIGIN = 0x20240000, LENGTH = 256K /* RAM change alone will not cause problem */
FLASH (rwx): ORIGIN = 0x60064000, LENGTH = 6000K
ERAM (rwx): ORIGIN = 0x70000000, LENGTH = 16384K
}
...
[reset of the linker script not changed]
---------------------
Thanks,
Jian