Thank you Jakub.... I tried your suggestions.. Following are the results
Before Loading HelenOS
U-Boot# bdinfo
*arch_number = 0x00000E05*
boot_params = 0x80000100
DRAM bank = 0x00000000
-> start = 0x80000000
-> size = 0x20000000
eth0name = cpsw
ethaddr = 78:a5:04:cc:b7:7a
eth1name = usb_ether
eth1addr = 78:a5:04:cc:b7:7c
current eth = cpsw
ip_addr = <NULL>
baudrate = 115200 bps
TLB addr = 0x9FFF0000
relocaddr = 0x9F74B000
reloc off = 0x1EF4B000
irq_sp = 0x9F62AF28
sp start = 0x9F62AF18
After loading HelenOS
U-Boot# bootm 0x80007FC0 - {Booting HelenOS}
## Transferring control to NetBSD stage-2 loader (at address 80000000) ...
.............
*arch_number = 0x00000000*
baudrate = 2675562971 bps
boot_params = 0x9F79D9DB
boot_params = 0x9F79D9DB
arm_freq = 0x9F79D9DB
dsp_freq = 0x8000D62C
*I have done following Modifications *
*File:asm.S*
SYMBOL(start)
ldr sp, =boot_stack
mov r0,r2 <-----first argument to bootstrap
b bootstrap
*File:types.h*
#define CONFIG_NR_DRAM_BANKS 2
typedef unsigned long ulong;
typedef struct bd_info {
unsigned int bi_baudrate; /* serial console baudrate */
ulong bi_arch_number; /* unique id for this board */
ulong bi_boot_params; /* where this board expects
params */
unsigned long bi_arm_freq; /* arm frequency */
unsigned long bi_dsp_freq; /* dsp core frequency */
unsigned long bi_ddr_freq; /* ddr frequency */
struct /* RAM configuration */
{
ulong start;
ulong size;
}bi_dram[CONFIG_NR_DRAM_BANKS];
} bd_t;
typedef struct {
size_t cnt;
task_t tasks[TASKMAP_MAX_RECORDS];
bd_t bdinfo_from_boot; /*Added by sourav*/
} bootinfo_t;
*File:main.c*
void bootstrap(*bd_t *store_r2_for_atags)
{
* bootinfo.bdinfo_from_boot = store_r2_for_atags;*
printf("%-12s= 0x%08lX\n",
"arch_number",bootinfo.bdinfo_from_boot.bi_arch_number);
printf("baudrate = %6u bps\n",
bootinfo.bdinfo_from_boot.bi_baudrate);
printf("%-12s= 0x%08lX\n", "boot_params",
(ulong)bootinfo.bdinfo_from_boot.bi_boot_params);
printf("%-12s= 0x%08lX\n", "arm_freq",
(ulong)bootinfo.bdinfo_from_boot.bi_arm_freq);
printf("%-12s= 0x%08lX\n", "dsp_freq",
(ulong)bootinfo.bdinfo_from_boot.bi_dsp_freq);
I am just trying to read bdinfo , just to build confidence.
But, I am not getting the expected values :-(
I doubt is it something related to LOAD ADDRESS = 80000000 ?
beagebone _black Load = 80008000 ?
On Fri, Feb 24, 2017 at 5:27 PM, Jakub Jermář <[email protected]> wrote:
> Hi Sourav,
>
> On 02/24/2017 09:11 PM, sourav punoriyar wrote:
> > from : HelenOS/boot/arch/arm32/src/asm.S and map files.
> >
> > SYMBOL(start)
> > ldr sp, =boot_stack
> > b bootstrap
> >
> > If we keep an inline assembly in
> >
> > void bootstrap(void)
> > {
> > int *store_r2_for_atags = 0;
> > asm volatile ("mov %%r2, %0" : "=r" (store_r2_for_atags)); //TODO:
> > Sourav Punoriyar
> > ........
> >
> > Uboot store the params info in r2 and passes..
> > As r2 is not used before branching to bootstrap( ). Will the above line
> > of code will give me the value stored in r2. Are there possibilities of
> > r2 getting modified before reaching to this line ?
>
> I am afraid r2 can indeed get clobbered just before you save it at the
> beginning of bootstrap. The reason is that the compiler knows that
> bootstrap() has no arguments so it can use r2 as a scratch register for
> whatever reason. To do this properly, you should either save it manually
> in the asm.S file or pass it as an argument to bootstrap.
>
> HTH,
> Jakub
>
>
> >
> >
> > Regards,
> > Sourav Punoriyar
> >
> >
> > On Thu, Feb 23, 2017 at 3:33 AM, Jakub Jermář <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> > On 02/22/2017 09:40 PM, Jakub Jermář wrote:
> > >> Confusions i am having:
> > >> 1> The bootargs info are given in r2 register. How do i preserve
> it when
> > >> stage-2 boot-loader comes into action , because till the kernel
> comes
> > >> into picture i will loose the info passed from uboot.
> > >> -------> i feel i need to preserve the info passed from Uboot so
> that i
> > >> can pass it down to the kernel and initialize boot_args via NetBSD
> > >> stage-2 loader .
> > >
> > > Yes, the best way to communicate information between the loader
> and the
> > > kernel is via the bootinfo structure. Just feel free to add a
> member
> > > which will hold the address from r2. Note that this structure
> needs to
> > > be modified in two places: in the loader and also in the kernel. We
> > > should probably fix this dichotomy by moving it under abi/.
> >
> > One more thing - the arguments can theoretically overlap with memory
> > used by the kernel, so it may be a good idea to actually pass them
> as a
> > copy rather than by reference to the kernel.
> >
> > Jakub
> >
> > _______________________________________________
> > HelenOS-devel mailing list
> > [email protected] <mailto:[email protected]>
> > http://lists.modry.cz/listinfo/helenos-devel
> > <http://lists.modry.cz/listinfo/helenos-devel>
> >
> >
> >
> >
> > _______________________________________________
> > HelenOS-devel mailing list
> > [email protected]
> > http://lists.modry.cz/listinfo/helenos-devel
> >
>
> _______________________________________________
> HelenOS-devel mailing list
> [email protected]
> http://lists.modry.cz/listinfo/helenos-devel
>
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel