<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックLPC55S16 TrustZone ThreadX</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1792939#M55195</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;I am currently using the LPC55S16EVK board and developing a small program using TrustZone and ThreadX. I am running using the &lt;STRONG&gt;hello_world_s&lt;/STRONG&gt; example from the SDK version 2.15 and I am adding ThreadX component into the &lt;STRONG&gt;hello_world_ns&amp;nbsp;&lt;/STRONG&gt;application. I have added the TX_SINGLE_MODE_NON_SECURE flag in the Preprocessor of the mentioned project. My main file for the secure world only performs a call to Normal World, while the non-secure main file is shown here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*
 * Copyright 2018 NXP
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "veneer_table.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_power.h"
#include "tx_api.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define DEMO_STACK_SIZE      1024
#define DEMO_BYTE_POOL_SIZE  9120
#define DEMO_BLOCK_POOL_SIZE 100
#define DEMO_QUEUE_SIZE      100
#define PRINTF_NSE DbgConsole_Printf_NSE
/*******************************************************************************
 * Prototypes
 ******************************************************************************/
TX_THREAD my_thread;
void my_thread_fnc(ULONG thread_input);
/* memory pool */
char mem_pool[DEMO_BYTE_POOL_SIZE];
TX_BYTE_POOL byte_pool_0;
/*******************************************************************************
 * Code
 ******************************************************************************/

void SystemInit(void)
{
}
/*!
 * @brief Main function
 */
int main(void)
{
    int result;

    /* set BOD VBAT level to 1.65V */
    POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);

    PRINTF_NSE("Welcome in normal world!\r\n");

    tx_kernel_enter();

    return 0;
}

void tx_application_define(VOID *first_unused_memory)
{
	int ret = 0xFF;
	 CHAR *pointer = TX_NULL;

	TX_THREAD_NOT_USED(first_unused_memory);

	/* Create a byte memory pool from which to allocate the thread stacks.  */
	tx_byte_pool_create(&amp;amp;byte_pool_0, "byte pool 0", (VOID *)mem_pool, DEMO_BYTE_POOL_SIZE);
    /* Allocate the stack for thread 0.  */
    tx_byte_allocate(&amp;amp;byte_pool_0, (VOID **)&amp;amp;pointer, DEMO_STACK_SIZE, TX_NO_WAIT);

    /* Create the main thread.  */
    ret = tx_thread_create(&amp;amp;my_thread, "thread 0", my_thread_fnc, 0, pointer, DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE,
                     TX_AUTO_START);
    /* Release the block back to the pool.  */
    tx_block_release(pointer);

}

void my_thread_fnc(ULONG thread_input)
{
	PRINTF_NSE("Thread 0 started...\r\n");

	while(1)
	{
		tx_thread_sleep(10);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After starting the kernel and the task (ret value inside tx_application_define returns correctly), it triggers an HardFault on the instruction shown below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rjmalmeida0_2-1705921384986.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/259416i8A77105DAF749078/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rjmalmeida0_2-1705921384986.png" alt="rjmalmeida0_2-1705921384986.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;STRONG&gt;BX lr&lt;/STRONG&gt; instruction crashes the system as the Link Registers shows an invalid memory value.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;BR /&gt;I attached the TrustZone config file.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;BR /&gt;Rui&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2024 11:03:48 GMT</pubDate>
    <dc:creator>rjmalmeida0</dc:creator>
    <dc:date>2024-01-22T11:03:48Z</dc:date>
    <item>
      <title>LPC55S16 TrustZone ThreadX</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1792939#M55195</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I am currently using the LPC55S16EVK board and developing a small program using TrustZone and ThreadX. I am running using the &lt;STRONG&gt;hello_world_s&lt;/STRONG&gt; example from the SDK version 2.15 and I am adding ThreadX component into the &lt;STRONG&gt;hello_world_ns&amp;nbsp;&lt;/STRONG&gt;application. I have added the TX_SINGLE_MODE_NON_SECURE flag in the Preprocessor of the mentioned project. My main file for the secure world only performs a call to Normal World, while the non-secure main file is shown here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*
 * Copyright 2018 NXP
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "veneer_table.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_power.h"
#include "tx_api.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define DEMO_STACK_SIZE      1024
#define DEMO_BYTE_POOL_SIZE  9120
#define DEMO_BLOCK_POOL_SIZE 100
#define DEMO_QUEUE_SIZE      100
#define PRINTF_NSE DbgConsole_Printf_NSE
/*******************************************************************************
 * Prototypes
 ******************************************************************************/
TX_THREAD my_thread;
void my_thread_fnc(ULONG thread_input);
/* memory pool */
char mem_pool[DEMO_BYTE_POOL_SIZE];
TX_BYTE_POOL byte_pool_0;
/*******************************************************************************
 * Code
 ******************************************************************************/

void SystemInit(void)
{
}
/*!
 * @brief Main function
 */
int main(void)
{
    int result;

    /* set BOD VBAT level to 1.65V */
    POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);

    PRINTF_NSE("Welcome in normal world!\r\n");

    tx_kernel_enter();

    return 0;
}

void tx_application_define(VOID *first_unused_memory)
{
	int ret = 0xFF;
	 CHAR *pointer = TX_NULL;

	TX_THREAD_NOT_USED(first_unused_memory);

	/* Create a byte memory pool from which to allocate the thread stacks.  */
	tx_byte_pool_create(&amp;amp;byte_pool_0, "byte pool 0", (VOID *)mem_pool, DEMO_BYTE_POOL_SIZE);
    /* Allocate the stack for thread 0.  */
    tx_byte_allocate(&amp;amp;byte_pool_0, (VOID **)&amp;amp;pointer, DEMO_STACK_SIZE, TX_NO_WAIT);

    /* Create the main thread.  */
    ret = tx_thread_create(&amp;amp;my_thread, "thread 0", my_thread_fnc, 0, pointer, DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE,
                     TX_AUTO_START);
    /* Release the block back to the pool.  */
    tx_block_release(pointer);

}

void my_thread_fnc(ULONG thread_input)
{
	PRINTF_NSE("Thread 0 started...\r\n");

	while(1)
	{
		tx_thread_sleep(10);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After starting the kernel and the task (ret value inside tx_application_define returns correctly), it triggers an HardFault on the instruction shown below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rjmalmeida0_2-1705921384986.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/259416i8A77105DAF749078/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rjmalmeida0_2-1705921384986.png" alt="rjmalmeida0_2-1705921384986.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;STRONG&gt;BX lr&lt;/STRONG&gt; instruction crashes the system as the Link Registers shows an invalid memory value.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;BR /&gt;I attached the TrustZone config file.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;BR /&gt;Rui&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 11:03:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1792939#M55195</guid>
      <dc:creator>rjmalmeida0</dc:creator>
      <dc:date>2024-01-22T11:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 TrustZone ThreadX</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1793051#M55205</link>
      <description>&lt;P&gt;Furhter testing shows that LR does not present invalid values. The call for&amp;nbsp;_tx_thread_shell_entry when a thread is ready to run triggers an HardFault_Handler&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 14:23:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1793051#M55205</guid>
      <dc:creator>rjmalmeida0</dc:creator>
      <dc:date>2024-01-22T14:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S16 TrustZone ThreadX</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1794697#M55223</link>
      <description>&lt;P&gt;I was able to get ThreadX runnig on non-secure world by adding the SDK ThreadX folder into a VSCode generated&amp;nbsp;&lt;STRONG&gt;hello_word&lt;/STRONG&gt; TrustZone project. I added ThreadX on both secure and non-secure apps and added the macro&amp;nbsp;&lt;STRONG&gt;TX_SINGLE_MODE_SECURE&amp;nbsp;&lt;/STRONG&gt;on the secure app and&amp;nbsp;&lt;STRONG&gt;TX_SINGLE_MODE_NON_SECURE&amp;nbsp;&lt;/STRONG&gt;on the non-secure app.&amp;nbsp;&lt;BR /&gt;Althrough it seems to work correctly I am not sure if this configuration is correct.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 14:14:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S16-TrustZone-ThreadX/m-p/1794697#M55223</guid>
      <dc:creator>rjmalmeida0</dc:creator>
      <dc:date>2024-01-24T14:14:04Z</dc:date>
    </item>
  </channel>
</rss>

