Running a standalone executable file in P1020RDB

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

Running a standalone executable file in P1020RDB

1,169 Views
ricardofranca
Contributor II

Hello,

I intend to run some simple programs in a P1020RDB (without any interference from an OS, as I am interested in some real-time aspects of my programs) but I have no experience in dealing with u-boot or any board that is more complex than old MCU SDKs (which run bare-metal programs without much configuration).

 

- Is there any empty RAM space where I could upload an ELF or binary file? I assume the 2GB DDR3 goes from 0x0 to 0x200000 but I am not sure about it... when looking at this memory range via u-boot "md" command, it did not look empty.

- Is it possible to call a standalone program from u-boot using "go" or "bootelf"?

If none of my thoughts make sense, I am open to other ideas and corrections, of course. For the moment, I intend to use only the basic environment (board + serial connection via UART0 + Tera Term). I intend to generate my executable files using a Green Hills compiler that is able to generate code for this board.

Thanks!

Ricardo

0 Kudos
3 Replies

1,157 Views
yipingwang
NXP TechSupport
NXP TechSupport

In u-boot, DDR memory map is as the following.

* 0x0000_0000 0x7fff_ffff      DDR             Up to 2GB cacheable

 

Typically U-Boot is built to reside/execute in the upper portion of main memory, and the remainder of low memory is available for whatever.

U-Boot will start its stack at the end of SDRAM, or BASE+SIZE. So the region between CONFIG_SYS_TEXT_BASE+(size of u-boot.bin) and the end of SDRAM is the available stack area should be available.

U-Boot will also use memory below CONFIG_SYS_TEXT_BASE for its malloc() pool. The size of that region is defined by CONFIG_SYS_MALLOC_LEN.

So the memory between CONFIG_SYS_SDRAM_BASE and
CONFIG_SYS_TEXT_BASE-CONFIG_SYS_MALLOC_LEN should be available.

 

'examples/hello_world.c' contains a small "Hello World" Demo
application; it is automatically compiled when you build U-Boot.
It's configured to run at address 0x00040004, so you can play with it
like that:

=> loads
## Ready for S-Record download ...
~>examples/hello_world.srec
1 2 3 4 5 6 7 8 9 10 11 ...
[file transfer complete]
[connected]
## Start Addr = 0x00040004

=> go 40004 Hello World! This is a test.
## Starting application at 0x00040004 ...
Hello World
argc = 7
argv[0] = "40004"
argv[1] = "Hello"
argv[2] = "World!"
argv[3] = "This"
argv[4] = "is"
argv[5] = "a"
argv[6] = "test."
argv[7] = "<NULL>"
Hit any key to exit ...

## Application terminated, rc = 0x0

0 Kudos

1,134 Views
ricardofranca
Contributor II

Hello,

Thanks for your advice! Though I did not find the actual hello.srec (U-Boot was already built in the board and I did not find either the source or the binary file in the board documentation USB drive), I managed to run some other simple code.

Is it possible to read and send characters via UART0? According to the processor documentation, the default address for CCSRBAR is 0xFF700000,  but it seems to be elsewhere in this board, as any attempt to read or write in this 0xFF704500 (which, I suppose, would be UART0, register 1) causes a bad trap. What is the actual CCSRBAR address?

 

0 Kudos

968 Views
yipingwang
NXP TechSupport
NXP TechSupport

You could download hello_world.srec in u-boot through tftp commands.

0 Kudos