MCUXpresso Debugger Console with LPC-Link2 (LPC4370)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MCUXpresso Debugger Console with LPC-Link2 (LPC4370)

ソリューションへジャンプ
3,570件の閲覧回数
simon_prentice
Contributor III

I have two LPC-Link2 boards; one as the debugger and one as the target.

MCUXpresso IDE v10.2.0 [Build 759] [2018-05-15] .

Thanks to the NXP community I now have Fast GPIO (100MHz) and HSADC (80Msps).

I now also have a massive array full of data which I want to output to a format I can use to evaluate it.

As yet I've not managed to get data output to the Debug Console and need some help getting it running.

I went back a step and started with the periph_systick example.

Set the library as Redlib semihost (in Settings->MCU Linker->Managed Linker Script)

debug.png

Added the following to the code and run.

 DEBUGINIT();
 DEBUGOUT("talk\r\n");
 printf("talk\r\n");

The Debugger Console output has some information regarding the status of the debug but none of the 'user' output data.

GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Program stopped.
0x10402d62 in ?? ()
No line 85 in file "C:/nxp/workspace/periph_systick/src/systick.c".
Temporary breakpoint 2, main () at ../src/systick.c:72
72  SystemCoreClockUpdate();
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 4, main () at ../src/systick.c:83
83   DEBUGOUT("talk\r\n");
Breakpoint 3, main () at ../src/systick.c:84
84   printf("talk\r\n");

What obvious thing have I missed this time?

Full code below:

int main(void)
{
 SystemCoreClockUpdate();
 Board_Init();
 DEBUGINIT();
 DEBUGOUT("talk\r\n");
 printf("talk\r\n");
 /* Enable and setup SysTick Timer at a periodic rate */
 SysTick_Config(SystemCoreClock / TICKRATE_HZ);
 while (1) {
  DEBUGOUT("talk\r\n");
  printf("talk\r\n");
  __WFI();
 }
}

Thanks, Simon.

0 件の賞賛
返信
1 解決策
3,095件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

So I have just gone through the process as follows:

  • Imported the projects "lpc_board_nxp_lpclink2_4370", "lpc_chip_43xx" and "periph_blinky" from the LPCOpen package provided inside the IDE's Examples subdirectory (lpcopen_2_12_lpcxpresso_nxp_lpclink2_4370_g.zip).
  • Modifed systick.c inside the "periph_blinky" project to add a "hello world" printf call after the call to Board_Init()
  • Used the Quick Settings menu on the Quickstart Panel to change the "periph_blinky" to use the Redlib (semihost-mb-nf) library.
  • In the "lpc_board_nxp_lpclink2_4370" project, I then modified board.c to simply comment out the include of retarget.h (which is sufficient to stop the redirecting of printf output to the UART).

Then after doing a full clean build of the projects, I get semihosted printf output when debugging "periph_blinky"

Regards,

MCUXpresso IDE Support

元の投稿で解決策を見る

7 返答(返信)
3,096件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

So I have just gone through the process as follows:

  • Imported the projects "lpc_board_nxp_lpclink2_4370", "lpc_chip_43xx" and "periph_blinky" from the LPCOpen package provided inside the IDE's Examples subdirectory (lpcopen_2_12_lpcxpresso_nxp_lpclink2_4370_g.zip).
  • Modifed systick.c inside the "periph_blinky" project to add a "hello world" printf call after the call to Board_Init()
  • Used the Quick Settings menu on the Quickstart Panel to change the "periph_blinky" to use the Redlib (semihost-mb-nf) library.
  • In the "lpc_board_nxp_lpclink2_4370" project, I then modified board.c to simply comment out the include of retarget.h (which is sufficient to stop the redirecting of printf output to the UART).

Then after doing a full clean build of the projects, I get semihosted printf output when debugging "periph_blinky"

Regards,

MCUXpresso IDE Support

3,095件の閲覧回数
simon_prentice
Contributor III

Thank you!

I started with a new/empty workspace folder, followed your instructions and everything worked.

Not sure if my problem is due to starting with lpcopen_3_02_lpcxpresso_link2_4370.zip or if the projects were not being cleaned sufficiently.

Just one more thing, when I don't comment out "retarget.h" where is the UART output on the LPC-Link2 board?
If this is too much of a major follow-up question I'll post a new one.

0 件の賞賛
返信
3,095件の閲覧回数
simon_prentice
Contributor III

Found it.  Thanks.

/**
 * @brief Initialize the UART interface
 * @param pUART : Pointer to UART register interface used on this board
 * @return Nothing
 * @note This function will currently support USART2 only, it will setup
 *    USART2 pin mux [P2.10 : UART2_TXD J3 -> Pin 8, P2.11 :
 *    UART2_RXD ->  J3 Pin-7]. For other UART/USART the application
 *   should setup pin-muxing on its own.
 */
void Board_UART_Init(LPC_USART_T *pUART);

0 件の賞賛
返信
3,095件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

Double check that you have cleaned and then rebuilt both your library projects as well as the main application project after making the changes.

Regards,

MCUXpresso IDE Support

0 件の賞賛
返信
3,095件の閲覧回数
simon_prentice
Contributor III

Hi, That's a fair suggestion.

I made a change to board.c to remove the call to DEBUGINIT(), then cleaned ALL projects and rebuilt periph_systick.

Stepping through the code although the code view is correct it is still running against old code.

You can see it in the images below as it has hit a line of code I've removed.

Even though its commented out, it hits DEBUGINIT() and therefore Board_Debug_Init().

Are there other project files which require deleting outside of "clean"?

debugg5.PNG

debugg6.PNG

0 件の賞賛
返信
3,095件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

By default, your LPCOpen board library will probably be redirecting printf to UART. For details of how to change this, see section 15.5.4, "Printf when using LPCOpen", of the MCUXpresso IDE v10.2 User Guide.

In addition, if you are going to output a large amount of data, you might also want to use the Semihost-mb-nf variant of the library in order to increase the output speed.

Regards,

MCUXpresso IDE Support

0 件の賞賛
返信
3,095件の閲覧回数
simon_prentice
Contributor III

Hi, Thank you for the recommendation.

I've gone to the manual as you suggested and have set the following (shown below).

Sadly I still get no Debugger Console output

Managed Linker Script -> semihost-mb-nf variant selected
deug4.png
board.h -> DEBUG_SEMIHOSTING defined
deug5.PNG
board.c -> retarget.h include reference left in
deug6.PNG

When stepping through the Board_Init()->DEBUGINIT() code

deug9.PNG

it still hits the UART initialisation in Board_Debug_Init()

deug7.PNG

which surprises me as it looks like this should not be called.

deug8.PNG

0 件の賞賛
返信