Hi People, i am beginner in RS08 and CW. I am trying to p...

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

Hi People, i am beginner in RS08 and CW. I am trying to p...

3,049 Views
jlflorio
Contributor I
Hi People, i am beginner in RS08 and CW. I am trying to protect the Flash reseting SECD bit in NVOPT. How can i do this using relocable assembly?
Labels (1)
0 Kudos
11 Replies

697 Views
bigmac
Specialist III
Hello,
 
To program the NVOPT register in flash, you could add the following lines at the end of your code -
 
   ORG   NVOPT  ; Address $3FFC
   DC.B  0      ; Enable protection
 
This should program the value zero at the NVOPT location.
 
Regards,
Mac
 
0 Kudos

697 Views
jlflorio
Contributor I
Did not work again: error=vector allocated at absolut adr.0x3ffd overlaps with section placed in segment absSeg0.
I think ORG dont work with relocable assembly. I tried :
 
ABSENTRY NVOPT
DC.B $FE
 
With no sucess (no error at compilation, but SECD bit remain 1)
 
0 Kudos

697 Views
CompilerGuru
NXP Employee
NXP Employee
ORG works in relocatable assembly, just as ABSENTRY. Given the error message you get, your problem is that something is already placed at address 0x3ffd, check in the map file what it is, it contains all the objects sorted by address too.

Daniel
0 Kudos

697 Views
CompilerGuru
NXP Employee
NXP Employee
And, before I forget it, if you place something at a fixed address using relocatable assembly, exclude that area from the prm file so the linker does not place anything there.

Danielhttp://forums.freescale.com/post?board.id=8BITCOMM&message.reply_to_id=10857#" rel="nofollow" target...
0 Kudos

697 Views
jlflorio
Contributor I
Tks Daniel. I saw the prm file(didnt find .MAP file - how can i get it?). Reset vector is placed in 3ffd to 3fff position. No other use for these positions We are trying to change NVOPT, placed in 3ffc position (just a bit, SECD). I see no conflict with these positions. Why the linker error?
0 Kudos

697 Views
bigmac
Specialist III
Hello,
 
I did try my suggested code in a new RS08 project created by the wizard, and the expected result was obtained without error.
 
I think your problem is not associated with the ORG  NVOPT directive, since this resides at address $3FFC.  Your error message actually references address $3FFD, the start of the JMP instruction to the start of the program (for the RS08 it is not a vector).  It is this that is probably defined more than once.  Did you create the project, in the first instance, using the wizard, and was the RS08 device specified at the outset?
 
If your difficulties persist, you might consider posting your code, or preferably the complete CW project.
 
It might be possible that you do not currently have a map file because you have never had a successful compile/link.  If you found the PRM file, you should be able to find the map file.
 
Finally, your previous use of the ABSENTRY directive is not correct.
 
Regards,
Mac
 
0 Kudos

697 Views
jlflorio
Contributor I
Dear Mac, the project works yet (software and hardware). We've made for a client using RS08 (is an automotive aplication). Now we must protect the software,just this. There is no MAP file (didnt created), but PRM file where i saw the reset vector. I think you are right, the problem is not the NVOPT, but something else. I can compile (without errors) and run over the product, very well. When i put ORG NVOPT - DC.B $0 (just this modification), come the error. Its our first product  developement  with Freescale's MCU, we have no great esperiency with it. Because it , we ask for your help.
0 Kudos

697 Views
bigmac
Specialist III
Hello,
 
It is not clear why the error should suddenly occur with the additional instructions to enable protection.  However, I was able to simulate the same error by adding the following to the end of the main.asm file of my test project.
 
   ORG   NVOPT  ; Address $3FFC
   DC.B  0      ; Enable protection
 
   JMP   _Startup ; This instruction starts at $3FFD
 
In this case, the reason the error occurred is that the reset "vector" is defined in both main.asm and the PRM file.  Commenting out the entry in the PRM file eliminated the error.
 
Possibly your problem might be something similar.
 
Regards,
Mac
 
0 Kudos

697 Views
jlflorio
Contributor I
Sorry BMac, didnt worked. Vector 0 was commented by PRM. Compiled withou error, but at download time come "ELF Loader Error while writing 3ffc...41fc. no memory at this adress". As you see, errors without sense.. I think some kind of procedure (Flash protect )should be more easier, even for beginners, but i am sure we can find a solution.
 
 
0 Kudos

697 Views
CompilerGuru
NXP Employee
NXP Employee
Sounds like you did not add another directive after the ORG area to switch back to
relocatable mode.
Everything after the ORG will be places at that address, if there is some code you want to code afterwards, use a SECTION or another ORG directive to specify a different location.

Daniel
0 Kudos

697 Views
UK_CF_FAE
NXP Employee
NXP Employee
jlflorio,
 
I quote from your reply to this thread:
Dear Mac, the project works yet (software and hardware). We've made for a client using RS08 (is an automotive aplication).
 
 
Freescale does not recommend that you use the RS08 in an automotive application.The product is only being offered in a -40-85ºC temp range with limited Flash write/erase cycling.  Furthermore, it does not offer Burn-In, does not have a charge pump nor BIST, has limited fault grade coverage, etc.  Please consider either a 908QY, 908QB, or the 9S08SG8/4 products that are in production for your low end automotive needs.
 
Mark
0 Kudos