Memory switch in DSP56303

Started by pal_ingenieria May 31, 2010
Dear folks,
As you know, after a RESET, MS bit in the OMR is 0 by default, so the memory configuration consist of the following: 4K of program memory (0x0-0xFFF), 2K of X data and 2K of Y data.
After RESET, I load the program memory by using the bootloader as usual.
After that, my program sets the MS bit (bit 7) in the OMR in order to change the memory configuration to 2K of program memory (0x0-0x7FF), 3K of data memory X and 3K of data memory Y.
The problem ocurrs when setting the MS bit. The higher part of program memory starting from 0x0400 to 0x07FF is changed and therefore, the program is modified.
How I can avoid this situation?

Thanks in advance
Hi Pal,

It's strange, I don't think program memory starting from 0x0400 to 0x07FF
should be affected if you just set MS(bit 7) after bootload. It should not
happen. Are you sure the P memory starting from 0x0400 to 0x07FF are all
correct before you changing memory configuration? Have you checked that?

The work-around way I can think is to define your P code which is starting
from 0x0400 to 0x07FF directly into x/y memory. After bootloader, before run
your final program, run mini-loader to copy code in x/y into p memory.
for example:

org p:$100
mini_loader:
copy x:$400~$7ff to p:$400~$7ff
jsr actual P start address.
org p:$400,x:$400
move x1,y1
....
....
rts

--
Best Regards.

Johnny Chen
2010/5/29 pal_ingenieria

> Dear folks,
> As you know, after a RESET, MS bit in the OMR is 0 by default, so the
> memory configuration consist of the following: 4K of program memory
> (0x0-0xFFF), 2K of X data and 2K of Y data.
> After RESET, I load the program memory by using the bootloader as usual.
> After that, my program sets the MS bit (bit 7) in the OMR in order to
> change the memory configuration to 2K of program memory (0x0-0x7FF), 3K of
> data memory X and 3K of data memory Y.
> The problem ocurrs when setting the MS bit. The higher part of program
> memory starting from 0x0400 to 0x07FF is changed and therefore, the program
> is modified.
> How I can avoid this situation?
>
> Thanks in advance
>
Hi Johnny:

Thanks for your advice.

Nothing is said in the DSP56303 user's manual about this behaviour. According to this manual, the highest 2K portion of Pmem (from 0x800 to 0xFFF) is switched to X and Y data memory.
The test I did consisted of loading the program by means of the ONCE debugger. The program is about 3K.

After run it, in the first few lines of the program, it sets the MS bit on the OMR. Then the program memory from 0x400 is completely changed with random values, according to the data window on the debugger. If I clear the MS bit again, the memory returns to normal values.

I think the DSP makes a kind of memory re-alocation.

The workaround that I thought (almost same as yours) is to load a code which only sets the MS bit and after jump again to the ROM bootloader and load the program as usual.

Best regards,

Pablo Liberman

Date: Mon, 31 May 2010 20:12:00 +0800
Subject: Re: [motoroladsp] Memory switch in DSP56303
From: b...@gmail.com
To: p...@hotmail.com
CC: m...
Hi Pal,

It's strange, I don't think program memory starting from 0x0400 to 0x07FF should be affected if you just set MS(bit 7) after bootload. It should not happen. Are you sure the P memory starting from 0x0400 to 0x07FF are all correct before you changing memory configuration? Have you checked that?

The work-around way I can think is to define your P code which is starting from 0x0400 to 0x07FF directly into x/y memory. After bootloader, before run your final program, run mini-loader to copy code in x/y into p memory.

for example:

org p:$100
mini_loader:
copy x:$400~$7ff to p:$400~$7ff
jsr actual P start address.

org p:$400,x:$400
move x1,y1
....
....
rts

--
Best Regards.

Johnny Chen

2010/5/29 pal_ingenieria

Dear folks,
As you know, after a RESET, MS bit in the OMR is 0 by default, so the memory configuration consist of the following: 4K of program memory (0x0-0xFFF), 2K of X data and 2K of Y data.
After RESET, I load the program memory by using the bootloader as usual.
After that, my program sets the MS bit (bit 7) in the OMR in order to change the memory configuration to 2K of program memory (0x0-0x7FF), 3K of data memory X and 3K of data memory Y.
The problem ocurrs when setting the MS bit. The higher part of program memory starting from 0x0400 to 0x07FF is changed and therefore, the program is modified.
How I can avoid this situation?

Thanks in advance