Facing issues in parsing string to transmit via UART in T2080RDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Facing issues in parsing string to transmit via UART in T2080RDB

483 Views
ChristinaK
Contributor II

I am trying to print a string via UART of T2080 RDB on UART terminal. Debugging revealed that the disassembly of string declaration itself is failing to show in the memory region that I had configured earlier. I am able to display a single character or numerical value on terminal(Teraterm) properly though. 

Kindly provide your inputs if you have tried this or something similar.

PFA the sample snippet below:

 

int32 main(void){

/*------------Initialization of UART done here-----------*/

char temp = 'b';

/* printing temp via UART on terminal successfully via function*/

uint8 var = 16;

/* printing var via UART on terminal successfully via function*/

char str[25] = "Hello World";

/*Debugging reveals a crash here, at str definition*/

 

//remaining code

}

 

 

 

Regards,

Christina

0 Kudos
Reply
2 Replies

465 Views
LFGP
NXP TechSupport
NXP TechSupport
please use the next syntax:
char str[25] = {"Hello World"};
0 Kudos
Reply

453 Views
ChristinaK
Contributor II

Hi,

At the char string array declaration as suggested above, the program crashes. The disassembly shows that the processor is trying to work through TOC and proceed to copy value from string array one-by-one into the memory and retain it back. And in the process, when R9 gets zero address value it crashes. We have setup TOC per instruction as mentioned below however I would like to know your opinion. If you can provide your inputs on the same, it would be helpful. The stack creation is done correctly and so is TOC declaration, prior to branching to MAIN.. PFA the TOC assembly code used by us: toc_Initialization:

//base_toc => TOC address

lis gpr2, (base_toc)@highest

ori gpr2, gpr2, (base_toc)@higher

rldicr gpr2, gpr2, 32, 31

oris gpr2, gpr2, (base_toc)@h

ori gpr2, gpr2, (base_toc)@l

addi gpr2, gpr2, 0x4000

addi gpr2, gpr2, 0x4000

R2 Register is the dedicated register for TOC as per IBM instructions given in (https://www.ibm.com/docs/en/aix/7.1?topic=overview-register-usage-conventions)).

TOC details are in: https://www.ibm.com/docs/en/aix/7.2?topic=program-understanding-programming-toc

 

 

Regards,

Christina

0 Kudos
Reply