Skip to content

Commit

Permalink
Upload mtb-example-ce240950-flash-ecc-injection [3263]
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlab-runner committed Feb 27, 2025
1 parent df90be7 commit 350ab82
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ This code example demonstrates the usage of the error correcting code (ECC) erro

[View this README on GitHub.](https://github.com/Infineon/mtb-example-ce240950-flash-ecc-injection)

[Provide feedback on this code example.](https://cypress.co1.qualtrics.com/jfe/form/SV_1NTns53sK2yiljn?Q_EED=eyJVbmlxdWUgRG9jIElkIjoiQ0UyNDA5NTAiLCJTcGVjIE51bWJlciI6IjAwMi00MDk1MCIsIkRvYyBUaXRsZSI6IlBETDogRmxhc2ggRUNDIGVycm9yIGluamVjdGlvbiIsInJpZCI6InR1c2EiLCJEb2MgdmVyc2lvbiI6IjEuMS4wIiwiRG9jIExhbmd1YWdlIjoiRW5nbGlzaCIsIkRvYyBEaXZpc2lvbiI6Ik1DRCIsIkRvYyBCVSI6IkFVVE8iLCJEb2MgRmFtaWx5IjoiQVVUTyBNQ1UifQ==)
[Provide feedback on this code example.](https://cypress.co1.qualtrics.com/jfe/form/SV_1NTns53sK2yiljn?Q_EED=eyJVbmlxdWUgRG9jIElkIjoiQ0UyNDA5NTAiLCJTcGVjIE51bWJlciI6IjAwMi00MDk1MCIsIkRvYyBUaXRsZSI6IlBETDogRmxhc2ggRUNDIGVycm9yIGluamVjdGlvbiIsInJpZCI6InR1c2EiLCJEb2MgdmVyc2lvbiI6IjIuMC4wIiwiRG9jIExhbmd1YWdlIjoiRW5nbGlzaCIsIkRvYyBEaXZpc2lvbiI6Ik1DRCIsIkRvYyBCVSI6IkFVVE8iLCJEb2MgRmFtaWx5IjoiQVVUTyBNQ1UifQ==)


## Requirements

- [ModusToolbox™](https://www.infineon.com/modustoolbox) v3.2 or later (tested with v3.2)
- [ModusToolbox™](https://www.infineon.com/modustoolbox) v3.4 or later (tested with v3.4)
- Board support package (BSP) minimum required version:
- [KIT_T2G_C-2D-6M_LITE](https://www.infineon.com/cms/en/product/evaluation-boards/kit_t2g_c-2d-6m_lite/): v1.0
- Programming language: C
Expand Down Expand Up @@ -255,6 +255,7 @@ Version | Description of change
------- | ---------------------
1.0.0 | New code example.
1.1.0 | Fixed wrong character display.
2.0.0 | Updated to support ModusToolbox™ software v3.4
<br>
All referenced product or service names and trademarks are the property of their respective owners.
Expand Down
29 changes: 27 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "cybsp.h"
#include "cy_retarget_io.h"
#include <inttypes.h>
#include "mtb_hal.h"

/*******************************************************************************
* Macros
Expand Down Expand Up @@ -85,6 +86,10 @@ bool g_faultIrqOccurred = false;
/* Variable that will end up as constant data in flash and will be used for the error injection test */
const uint64_t FLASH_TEST_VAR = CORRECT_DATA;

/* For the Retarget -IO (Debug UART) usage */
static cy_stc_scb_uart_context_t UART_context; /** UART context */
static mtb_hal_uart_t UART_hal_obj; /** Debug UART HAL object */

/*******************************************************************************
* Function Name: handleFaultIrq
********************************************************************************
Expand Down Expand Up @@ -396,6 +401,8 @@ static void executeTestAccess(void)
*******************************************************************************/
int main(void)
{
cy_rslt_t result;

/* Will hold the correct parity for the configured test value */
uint8_t correctParity;

Expand All @@ -412,9 +419,27 @@ int main(void)
__enable_irq();

/* Initialize retarget-io to use the debug UART port */
Cy_SCB_UART_Init(UART_HW, &UART_config, NULL);
/* Debug UART init */
result = (cy_rslt_t)Cy_SCB_UART_Init(UART_HW, &UART_config, &UART_context);
if (result != CY_RSLT_SUCCESS)
{
CY_ASSERT(0);
}

Cy_SCB_UART_Enable(UART_HW);
cy_retarget_io_init(UART_HW);

/* Setup the HAL UART */
result = mtb_hal_uart_setup(&UART_hal_obj, &UART_hal_config, &UART_context, NULL);
if (result != CY_RSLT_SUCCESS)
{
CY_ASSERT(0);
}

result = cy_retarget_io_init(&UART_hal_obj);
if (result != CY_RSLT_SUCCESS)
{
CY_ASSERT(0);
}

/* \x1b[2J\x1b[;H - ANSI ESC sequence for clear screen */
printf("\x1b[2J\x1b[;H");
Expand Down

0 comments on commit 350ab82

Please sign in to comment.