Skip to contentSkip to conversation

bootcounter implementation for OMAP3

U-Boot Nitin Mahajan 3 participants 6 messages Mar 9, 2010 – Mar 10, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to implement the bootcount_store and bootcount_load methods for the OMAP3503 processor based board which I am using.

For this I decided to use the location at the end of scratchpad RAM, that is I am trying to write at location 0x480029BF. The code looks like this, but the boot loader hags when it encounters bootcount_load.

#ifdef CONFIG_BOOTCOUNT_LIMIT
void bootcount_store(ulong a)

{
	volatile ulong *save_addr = 
		(volatile ulong *)(0x480029BF);
	*save_addr = (BOOTCOUNT_MAGIC & 0xffff0000) | (a & 0x0000ffff);

}

ulong bootcount_load(void)

{
	
	volatile ulong *save_addr = (volatile ulong *)(0x480029BF);
	
	if ((*save_addr & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
		return 0;
	else
		return (*save_addr & 0x0000ffff);

}

#endif /* CONFIG_BOOTCOUNT_LIMIT */

Am I doing some thing wring fundamentally? Can I get some pointers towrads this?

Also this code I have put in cpu/arm_cortexa8/cpu.c. Is there a way I can put these functions in OMAP3 specific code and still have them called?

regards

-Nitin

New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/

#1 lore raw

Hi Nitin,

Quoted 8 lines

I am trying to implement the bootcount_store and bootcount_load methods for the OMAP3503 processor based board which I am using.

For this I decided to use the location at the end of scratchpad RAM, that is I am trying to write at location 0x480029BF. The code looks like this, but the boot loader hags when it encounters bootcount_load.

Quoted 6 lines

#ifdef CONFIG_BOOTCOUNT_LIMIT
void bootcount_store(ulong a)

{
	volatile ulong *save_addr = 
		(volatile ulong *)(0x480029BF);
	*save_addr = (BOOTCOUNT_MAGIC & 0xffff0000) | (a & 0x0000ffff);

You are writing a 32 bit entity to an non 32-bit aligned address. Although I do not know the omap too well, this can be a problem on any architecture.

Can you write 32-bot to that exact address from within the U-Boot commandline with e.g. "mm"?

Cheers
Detlev

Signature · 6 lines
Q: What do you get when you cross an elephant and a banana?
A: |elephant| * |banana| * sin(theta)
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#2 lore raw

Hello,

Quoted 35 lines · Detlev Zundel

From: Detlev Zundel <[email protected]>
Subject: Re: [U-Boot] bootcounter implementation for OMAP3
To: nitinm76 at yahoo.com
Cc: u-boot at lists.denx.de
Date: Tuesday, 9 March, 2010, 2:03 PM
Hi Nitin,

Quoted 1 line

I am trying to implement the bootcount_store and

bootcount_load

Quoted 1 line

methods for the OMAP3503 processor based board which I

am using.

Quoted 2 lines

For this I decided to use the location at the end of

scratchpad RAM,

Quoted 1 line

that is I am trying to write at location 0x480029BF.

The code looks like

Quoted 1 line

this, but the boot loader hags when it encounters

bootcount_load.

Quoted 7 lines

#ifdef CONFIG_BOOTCOUNT_LIMIT
void bootcount_store(ulong a)
{
??? volatile ulong *save_addr =
??? ??? (volatile ulong

*)(0x480029BF);

Quoted 1 line

??? *save_addr = (BOOTCOUNT_MAGIC &

0xffff0000) | (a & 0x0000ffff);

You are writing a 32 bit entity to an non 32-bit aligned address.
Although I do not know the omap too well, this can be a problem on any
architecture.

Quoted 3 lines

Can you write 32-bot to that exact address from within the U-Boot
commandline with e.g. "mm"?

That was the basic mistake I think. I was trying to write to a non 32 bit aligned address. This got solved, but I have some new errors saying this

## Error: environment overflow, "stdin" deleted ## Error: environment overflow, "stdout" deleted ## Error: environment overflow, "stderr" deleted ## Error: environment overflow, "bootcount" deleted

Does that mean the size allocated for env is smaller compared to the actual contents in env file. I am new to u-boot. Can you give some pointers on this?

regards

-Nitin

Quoted 16 lines

Cheers
? Detlev

Signature · 10 lines
Q: What do you get when you cross an elephant and a
banana?
A: |elephant| * |banana| * sin(theta)
--
DENX Software Engineering GmbH,? ? ? MD:
Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,? Office: Kirchenstr.5, D-82194
Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
dzu at denx.de

New Email addresses available on Yahoo!
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/

#3 lore raw

Hi Nitin,

Quoted 10 lines
Quoted 6 lines

You are writing a 32 bit entity to an non 32-bit aligned address. Although I do not know the omap too well, this can be a problem on any architecture.

Can you write 32-bot to that exact address from within the U-Boot commandline with e.g. "mm"?

That was the basic mistake I think. I was trying to write to a non 32 bit aligned address. This got solved, but I have some new errors saying this

Ok, thanks for the confirmation.

Quoted 4 lines

## Error: environment overflow, "stdin" deleted ## Error: environment overflow, "stdout" deleted ## Error: environment overflow, "stderr" deleted ## Error: environment overflow, "bootcount" deleted

[dzu at pollux u-boot-testing (master)]$ git grep "environment overflow"

common/cmd_nvedit.c:            printf ("## Error: environment overflow, \"%s\" deleted\n", name);
tools/env/fw_env.c:                     "Error: environment overflow, \"%s\" deleted\n",
Quoted 3 lines

Does that mean the size allocated for env is smaller compared to the actual contents in env file. I am new to u-boot. Can you give some pointers on this?

Only you can answer what you have defined for your configuration.

Cheers
Detlev

Signature · 6 lines
He who can properly define and divide is to be considered a god.
                                        -- Plato
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#4 lore raw

Hello,

Quoted 44 lines · Detlev Zundel

From: Detlev Zundel <[email protected]>
Subject: Re: [U-Boot] bootcounter implementation for OMAP3
To: nitinm76 at yahoo.com
Cc: u-boot at lists.denx.de
Date: Tuesday, 9 March, 2010, 10:52 PM
Hi Nitin,

Quoted 1 line
Quoted 1 line

You are writing a 32 bit entity to an non 32-bit

aligned address.

Quoted 1 line
Quoted 1 line

Although I do not know the omap too well, this can

be a problem on

Quoted 3 lines
Quoted 3 lines

any architecture.

Can you write 32-bot to that exact address from

within the U-Boot

Quoted 3 lines
Quoted 1 line

commandline with e.g. "mm"?

That was the basic mistake I think. I was trying to

write to a non 32

Quoted 1 line

bit aligned address. This got solved, but I have some

new errors

Quoted 1 line

saying this

Ok, thanks for the confirmation.

Quoted 1 line

## Error: environment overflow, "stdin" deleted?

? ? ? ? ? ? ? ?
? ? ? ? ? ?
???

Quoted 1 line

## Error: environment overflow, "stdout" deleted?

? ? ? ? ? ? ? ?
? ? ? ? ? ? ?

Quoted 2 lines

## Error: environment overflow, "stderr" deleted ## Error: environment overflow, "bootcount" deleted

[dzu at pollux u-boot-testing (master)]$ git grep "environment overflow"
common/cmd_nvedit.c:? ? ? ? ?
? printf ("## Error: environment overflow, \"%s\" deleted\n", name);
tools/env/fw_env.c:? ? ? ? ?
? ? ? ? ???"Error:
environment overflow, \"%s\" deleted\n",

Quoted 6 lines
Quoted 1 line

Does that mean the size allocated for env is smaller

compared to the

Quoted 1 line

actual contents in env file.? I am new to u-boot.

Can you give some

Quoted 1 line

pointers on this?

I just increased the size in my board specific configuration file. Now this feature of bootlimit and altbootcmd works for me on OMAP3.

Thanks for your time.

I was just wondering how to recover from errors such as bad CRC on uImage, where boot loader is not able to start booting the kernel for any reason.

In such case how to fallback to a different kernel.

-Nitin

Quoted 20 lines

Only you can answer what you have defined for your configuration.

Cheers
? Detlev

Signature · 12 lines
He who can properly define and divide is to be considered a
god.
? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ?
? ? ? ? -- Plato
--
DENX Software Engineering GmbH,? ? ? MD:
Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,? Office: Kirchenstr.5, D-82194
Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
dzu at denx.de

New Email names for you!
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/

#5 lore raw

Dear Nitin Mahajan,

Quoted 5 lines · In message <[email protected]> you wrote:

I was just wondering how to recover from errors such as bad CRC on uImage, = where boot loader is not able to start booting the kernel for any reason.

In such case how to fallback to a different kernel.

Please RTFM. This is documented there.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Why is an average signature file longer than an average Perl script??