I am developing an software based on a SDK 2.10.0 example. I am running the software on i.MXRT1050-EVK:-
rtos_examples->freertos_hello.
The example works.
I am porting the debugging part(serial port comm) of the code to another platform (outside of MCUXpresso). I want to be able to use PRINTF(...) to transmit data through serial port and displaying messages on serial comm terminals. Our linker file is different from the linker file generated by MCUXpresso, so, I need to know how to modify linker file in our platform to make serial debugging code works.
The attachments are files abstracted from MCUXpresso environment.
I have a few questions:-
Question 1
in board.c-> void BOARD_ConfigMPU(void), which of the regions are matters for the serial manager from the sdk example? Is NCACHE needed?
Is this part of the code in BOARD_ConfigMPU() needed?
while ((size >> i) > 0x1U)
{
i++;
}
if (i != 0)
{
/* The MPU region size should be 2^N, 5<=N<=32, region base should be multiples of size. */
assert(!(nonCacheStart % size));
assert(size == (uint32_t)(1 << i));
assert(i >= 5);
/* Region 9 setting: Memory with Normal type, not shareable, non-cacheable */
MPU->RBAR = ARM_MPU_RBAR(9, nonCacheStart);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, i - 1);
}
/* Region 10 setting: Memory with Device type, not shareable, non-cacheable */
MPU->RBAR = ARM_MPU_RBAR(10, 0x40000000);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4MB);
I am asking this question because not all the board.c file in the SDK has these regions (9 and 10) initialised.
Question 2
In the MCU Settings (MCUXpresso environment), or, in the memory.ld:-
MEMORY
{
/* Define each memory region */
BOARD_FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 0x4000000 /* 64M bytes (alias Flash) */
SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128K bytes (alias RAM) */
SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K bytes (alias RAM2) */
SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x40000 /* 256K bytes (alias RAM3) */
BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x1e00000 /* 30M bytes (alias RAM4) */
NCACHE_REGION (rwx) : ORIGIN = 0x81e00000, LENGTH = 0x200000 /* 2M bytes (alias RAM5) */
}
If my application is not using SDRAM, am I right to say, BOARD_SDRAM (rwx) can be ignored or removed?
As my application is using the serial manager ported from the freertos_hello example, is NCACHE_REGION (rwx) required for it to work?
The other memory regions:-
SRAM_DTC (rwx) - is this required for PRINTF?
SRAM_ITC (rwx) - is ths required for PRINTF
SRAM_OC (rwx) - is this required for PRINTF
Question 3
These are the preprocessor symbols defined for the example. Which of these are required for PRINTF?
__REDLIB__
CPU_MIMXRT1052DVL6B
SDK_DEBUGCONSOLE=1
XIP_EXTERNAL_FLASH=1
XIP_BOOT_HEADER_ENABLE=1
SERIAL_PORT_TYPE_UART=1
SDK_OS_FREE_RTOS
MCUXPRESSO_SDK
CPU_MIMXRT1052DVL6B_cm7
CR_INTEGER_PRINTF
__MCUXPRESSO
__USE_CMSIS
DEBUG
I am development an application outside of MCUXpresso.I am trying to find out why PRINTF fails to work after ported it from MCUXpresso to other platform. I am trying to find out what else is required to setup for PRINTF to work, such as the questions mentioned above.
Your helps would be very much appreciated. Thank you!
Best Regards,
Cindy
Hi Cindy:
For the Debug console, I would suggest you refer to chapter 53 of MCUXpresso SDK API Reference manual.
debug console driver should be included in your project.
For Q1: NCACHE is not necessary. DTC and ITC should be needed in your project.
Q2: If your application is not using SDRAM, BOARD_SDRAM (rwx) can be removed.
Q3: SDK_DEBUGCONSOLE=1 is needed , and __REDLIB__ or similar library is needed.
Regards
Daniel