Hello. I am working with some existing code that we previously used SDCC as the compiler for the Nordic Semiconductor nRF24E1. I am porting this code over to the Keil compiler and I am having some problems. With the SDCC compiler it appeared that we were running out of RAM before so we were using part of the program space as RAM. I was assuming we were doing this using the XDATA command. I could compile the code using the XDATA type on the variable that I needed to place in Program memory space. When using the SDCC compiler, the variable that was being placed in program memory space was being specified to be in a specific memory location. I am was not explicitly picking a location for the variable using Keil. When using the Keil compiler, the code will compile but when I call a function that would use the variable that would be in XDATA, the device responds in a weird manner. Is there a way to explicitly say place the XDATA here and then when I use XDATA it will work properly? Is there any documentation on using the XDATA to store variables or any examples that I could view?
My code will compile and when it does I get the following info: linking... Program Size: data=231.0 xdata=0 code=2885 To get this to compile I had to reduce the size of one of the variables (an array, reduced from 15 bytes to 8) so that the code would compile. I kept receiving data overflow errors with the array being a larger size. My question is: Looking at the above program size it states data = 231 and looking at the datasheet it states the nRF24E1 has 256 bytes of RAM. Why is it that I cannot use the entire contents of RAM? I could make use of the extra RAM if there is any available. Can you please let me know? In Keil, I am using the small memory model: variables in Data, code rom size: compact 2K functions, and no operating system.
Here is the information about my version of the Keil Compiler.
IDE-Version: µVision3 V3.72 Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2008
Tool Version Numbers: Toolchain: C51 Compiler/Assembler Kit Version: 8.17 Toolchain Path: C:\Keil\C51\BIN\ C Compiler: C51.Exe V8.17 Assembler: A51.Exe V8.01 Linker/Locator: BL51.Exe V6.15 Librarian: LIB51.Exe V4.24 Hex Converter: OH51.Exe V2.6 CPU DLL: S8051.DLL V3.64 Dialog DLL: DP51.DLL V2.53
Thanks for the help.
Josh
You may have 256 bytes of RAM, but if you are going to fit a stack there too, you must leave a suitable number of bytes for the stack.
If the chip has any XDATA memory, then you should configure your project to know about this memory. And then tag some variables as xdata.
Josh; It appears that you have a "non-standard' 8051 device. The program/code space is a von Neumann structure controled by the ERAM configuration. You will need to read the data sheets for that info but you can place variables in the XDATA space via two methods. You can select LARGE as the Memory Model and all your variables will be placed in XDATA space.
I do not recommend this method.
The second choice and the choice I recommend is to select SMALL as the memory Model and then explicitly assign your seldom used variables, your structs and your arrays into the XDATA space. Example is "int xdata my_var". How you drive the ERAM configuration, I will have to defer to the data sheets becaused I have never used this device. Bradford
Josh; I'm sorry that I failed to answer your original post. The true answer is "yes". There are instructions and examples for using xdata in the C51 Complete User's Guide under Memory Types -> XDATA. Also look at the Absolute Variable Location section of the manual. One example they give is: char xdata txt[256] _at_ 0xE000;/*array at xdata 0xE000*/.
somebody (the OP) would post which '51 derivative is in the thingy.
I seem to recall somewhere that it was posted that it was some SILabs chip
Erik
I agree. I think I read somewhere it came from the DS320 family. Bradford
From the Datasheet for the nRF24E1: The embedded microcontroller is the DW8051 MacroCell from Synopsys which is similar to the Dallas DS80C320 in terms of hardware features and instruction-cycle timing.
I sent an email request into the tech support at Nordic Semi and here is the response that I received. ********* The memory model of the 8051 can be a bit confusing :)
The chip has got 256 bytes of RAM, but only 128 of them can be addressed directly. This is the variables you define as "data" in Keil and is the default location for variables when using the small memory model.
In addition to those you have 128 bytes of RAM that must be reached through indirect addressing. In Keil you access those by defining the variables as "idata".
You have also got 1024 bytes of RAM in the "XDATA" space. To clarify, this is not a part of the program memory but a separate 1024 byte SRAM block connected to the 8051 processor.
Both data and idata shows up as "data" in the compile log in Keil, but you must make sure that none of these blocks exceed 128 bytes on their own.
IDATA is a bit slower than DATA, and XDATA is considerably slower, so when performance is important you should use DATA.
Best regards Torbjørn Øvrebekk Application Engineer Nordic Semiconductor
What the Nordic guys are telling is standard 8051 "bible" stuff!
See: www.8052.com/.../120112 for the links to the so-called "bible" for the 8051.
See: http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm for Keil's C51 extensions to deal with this;
See: http://www.keil.com/support/man/docs/c51/c51_le_memmodels.htm for Memory Models.
See also: http://www.8052.com/tutorial for basic 8051 architecture tutorials.
HTH.