Topic : code banking on upsd3454...

Forum : 8051

Original Post
Post Information Post
October 18, 2008 - 9:11pm
Guest

Dear sirs, I've spent the last 2 days (and today is saturday!) trying to use the code banking feature on upsd3454E.
Now it is running, but:
- the l51_bank.a51 cannot be used AS IS. It uses the movx a,@r0 instruction that WON'T run on upsd34xx; U should modify the assembly code to get it running, also I have declared my pdata stack 'cause U cannot enable the external stack...
- but more than this, I have encountered a lot of difficult on programming the flash when using banked code! If I use the ride IDE to flash the code, when I debug, it appears the "conflict result" message... I suppose that the merge between pld and code won't run very good when the code is banked. After a lot of digging, the only solution I've found was to merge pld and code fromd psdsoft, then flash the code also via psdsoft, finally from ride-options-debug I have checked only verify no erase nor download.

So I think:
1 U should provide a correct l51_bank.a51 source, or alert the users that it won't run as is on upsd34xx, but starting from ide level, not within the asm source!
2 can U tell me what's the correct procedure to use ride IDE for debug with banked code on upsd3454

I am a little bit bored: it's very difficult to face with time to market issues...

Best regards!

Replies
Post Information Post
+1
0
-1
October 21, 2008 - 9:43am
Guest

Hi
There are two options for the bank switching: with or without the use of the external stack. In the case of the uPSD devices, the MOVX @Ri instructions are not useable, and you cannot use the external stack. The other mode, also called 'PLM' for historical reasons uses only the internal stack. It must be selected for the uPSD devices.
Warning: when using the internal stack, you cannot call reentrant functions that have parameters on stack (typically printf..).
"Conflict when exploring code' are warning, no error messages. Most of times, you can ignore them.
Francis

+1
0
-1
October 23, 2008 - 12:11am
Guest

Thanks Francis for your reply!
I understand that maybe code banking is not the top choice for most upsd users, but U should admit that at this moment ride can improve a lot the code banking handling.
In effect PLM mode was not useful for me, 'cause I should use both code banking AND printf/sprintf functions, and I suppose this is the case of most upsd+code banking users; as stated, the user in this situation should dig into assembly code to solve the problem.
The "conflict when exploring code" was appearing after programming from Raisonance IDE the upsd flash and running the program; in this case the flash programming seems to be different from what was expected, the program runs out of control, U cannot stop it with breakpoints.
I have controlled the register window and I was suspecting the ride was programming the flash using the previous non-banked flash files, but also after a complete cleanup the conflict was not solved.
Really: I cannot ignore the conflict message, because I was unable to run/debug/test the program! Also stopping the program was requiring a lot of time, with the message appearing "Step not over yet, go on?". Why did the code merged and programmed from psdsoft runs ok, and the same code programmed from ride not?
Anyway, I think it would be very useful if, in a future release, eg:
- a correct and exhaustive a51 file for code banking was supplied with the ride kit
- when U place a breakpoint on a line of banked code, the program won't stop also when executing an instruction on same code offset, but different page
- the correspondance between module and bank is easier to set; now U should enter project-linker-code banking-modules-scroll the module list...
- also the asm/endasm pragmas was powered; at this time, U loose sync on debug information on the files with src control, and also on all the consecutive modules...
- when U change one project options, this action don't reset also all of the local options set on the module project files: this is a very boring bug
- U can dump on disk noth registers and memory
- when upsd34xx is selected as target, the "use external stack" option is automatically disabled and grayed

Best regards
Michele

+1
0
-1
November 10, 2008 - 2:39pm
Guest

Thanks for this report. We will clean up these items.

+1
0
-1
March 10, 2009 - 9:25pm
Guest

It's a while since I've been here, so this is a late reply.

I've been around the all same problems and concluded that the debugger was simply incompatible with banking. I ended up writing my own banking system specifically for uPSD, which also runs within the confines of the 32k limitations of RKit-Lite (uPSD can't usefully run banks bigger than 32k anyway). I don't know whether it is deliberate or a bug, but as well as limiting code to 32k, Lite also blocks compiling or linking to any addresses above 32k..

I implemented (most of ) a USB flash disk with fscanf etc. Yes, both data AND program in the big flash. I put this module in one (slave) bank and my 'user' application in the main bank. I got around the debugger problems by recompiling the slave bank as a single bank program with a stub main program as a separate project, and just switched projects when I had to chase a bug in the slave bank. Yes it still occasionally hits breakpoint addresses while running in the slave bank, but it's pretty obvious when it does, (keep an eye on the stack dump, and just check the page register if in doubt) and it's easy to recompile the bank with the offending code moved out of the way.

I don't think anyone ever explained what is going on when the machine seems to freeze and says "step not yet over". It seems that after a stop command, Ride single-steps the processor trying to get to the end of a line of the C code. If the processor is not executing the code Ride thinks it is, eg a page change or stack corruption, then this goes on forever and Ride times it out. At least that's how I figure it.

Tim Jackson

+1
0
-1
March 12, 2009 - 3:05pm
Guest

The problems reported by 'technico27' had been fixed (current version).
For the last message from Tim (Puposet), yes it is normal that bank switching does not work with the 32K version (at least for compiling/linking). I tested bank switching on a Raisonance 'bank-switching' project, and it works. I don't know if it works with several programs located into different banks.
For the 'step not yet over': yes, we use breakpoint for stepping at the C level, but when there is no more available breakpoint, we single-step at the assembly level. For extra-bank calls (a call from a bank to another bank), single-stepping could be quite long..

+1
0
-1
March 23, 2009 - 11:40am
Guest

Hi Francis, i tried to install the update, but the linker won't find the floating point library...
Maybe it has installed the limited version? Can I install this update?

+1
0
-1
March 23, 2009 - 11:42am
Guest

I've seen that in the ride\lib directory the RC51FPL.LIB file is only 1k size.
I am using large memory model with ieee floating point.
Anyway I can continue working with the old ride toolchain...

+1
0
-1
March 27, 2009 - 10:11am
Guest

Hi Francis, can U tell me if I can update the toolchain or if it is not available for me?
Thx