Hello, I have been using an xhuge array of size 512KB on the C167HSE and my software has been working fine. It is declared as follows: unsigned int xhuge x[256000]={0}; By looking at .M66 file (MEMORY MAP OF MODULE section), the begin, end, and the size looks like the following: 300000H 37CFFFH 07D000H Now I need to enlarge the array from 512KB to 800KB and I'm getting the following error: WARNING L5: SECTION LOCATED OUTSIDE CLASS AREA SECTION: ?XD0?MAIN CLASS: XDATA0 C167HSE has two 512KB RAM. How can I create a logical array of 400000 type int? Thanks in advance.
You should map the two 512K banks of RAM into address space so that they are contiguous. It can be done by adjusting the relevant ADDRSELx registers. If I understood the hardware manual for phyCORE-C167HS/E correctly, setting ADDRSEL1=0x2007 and ADDRSEL3=0x2807 will give you a 1M continuous block of RAM in address range 0x20000-0x2FFFFF. That's just an example, adjust ADDRSELx's to meet your needs. After that configure memory banks in Keil Target Options dialog, because now you have a single 1M block of RAM instead of two separate 512K ones. Then it should be possible to allocate a 800K array. Regards, - mike
Mike, Thanks for your help. I was able to compile the code, but now my problem is getting it to run in debug mode so I can verify the memory block. A snippet of my .a66 file looks like this: $SET (BUSCON1 = 0) %DEFINE (ADDRESS1) (200000H); (U2 512KB MAX) %DEFINE (RANGE1) (512K) $SET (BUSCON3 = 1) %DEFINE (ADDRESS3) (280000H); (U3 512KB MAX) %DEFINE (RANGE3) (300K) My Target-Option External Memory setting: #1 ROM 0x0 0x3FFFF #2 RAM 0x40000 0x3FFFF #3 RAM 0x200000 0xC3500 I think #2 RAM is needed for debugging and is taking it from either U2 or U3. Also, 3FFFF + C3500 is greater than 1MB, which requires more physical RAM than what C167H/SE has. Even if I go down to 700KB I still can't run it in debug. After playing with it a bit, it seems that I have to set BUSCON1 = 0 if I want to run it in debug. Is there anyway I can allocate 700KB for array and still test it in debug? Thanks!
With more time to play around with different configurations, the bottom line is that in order to allocate 800KB, both BUSCON1 and BUSCON3 have to be set to 1, U2 and U3 respectively. But to run the code in debug mode, BUSCON1 has to be set to 0. Is there any way to allocate an array size of 800KB and still run it in debug mode? Thanks in advance.
The following line
%DEFINE (RANGE3) (300K)