Serial Monitor download problem

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

Serial Monitor download problem

2,653 Views
mjbcswitzerland
Specialist V
Hi All
 
I am using the CodeWarrior IDE to download a non-banked project to FLASH via the serial monitor and have two problems:
 
1. It doesn't seem possible to protect a page in FLASH containing configuration data. During download all FLASH is first erased and the new program is loaded. This means that all configuration parameters stored in a certain memory page are lost at each download and have to be restored before testing can continue.
Has any one else had such an issue and found a work-around?
2. I have a non-banked design where the program uses code from 0x4000 in a linear manor up to 0xffff. As soon as it actually tries to download code to the region 0x8000..0x8200 it fails [the error message which appears says ELF LOADER "No memory at this address"].
If I ensure that the code avoids the 0x8000..0xbfff region (it can be between 0xc000 and 0xfff) it works fine.
Does anyone know what is wrong and if there is a solution? I am presently having to download using a different tool and debugging in the CodeWarrior environment is not possible since the symbol load (I have disabled the FLASH load) fails.
 
By the way I am using CodeWarrior 3.1 which I received with my DEMO9S12NE64. It is possible that there restrictions have been resolved in newer versions - does any one know more?
 
Best regards
 
Mark Butcher
www.mjbc.ch
 
 
Labels (1)
Tags (1)
0 Kudos
2 Replies

336 Views
BugBlatter
Contributor I
The memory range 0x8000-0xBFFF is a hole in the memory map into which other 16k pages of ROM are switched as part of the bank switching scheme of this CPU. You need to modify you .prm file to have two switched ROM pages and leave a hole in the memory map at 0x8000-0xBFFF. The sample projects that came with your kit do this - maybe you should look at the examples.

Anyway, here is the .prm file I use. Note the two 16k pages at 0x3C8000 and 0x3D8000 - these ROM areas get automatically switched to the range 0x8000-0xBFFF as the program runs.

NAMES
END

SECTIONS

RAM = READ_WRITE 0x2C00 TO 0x3DFF;
STACK_RAM = READ_WRITE 0x3E00 TO 0x3FFE;

/* unbanked FLASH ROM */
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xF77F;

/* banked FLASH ROM */
PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;
PAGE_3D = READ_ONLY 0x3D8000 TO 0x3DBFFF;

ROM_FF10 = READ_ONLY 0xFF10 TO 0xFF7F;
END

PLACEMENT
_PRESTART,
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
NON_BANKED /* runtime routines which must not be banked */
INTO ROM_4000,ROM_C000;
COPY INTO ROM_C000;
MyConstSegPage1 INTO PAGE_3C;
DEFAULT_ROM INTO PAGE_3D, PAGE_3C;
DEFAULT_RAM INTO RAM;
STACK_MEM INTO STACK_RAM;
END

STACKTOP 0x3FFF

336 Views
mjbcswitzerland
Specialist V
Hi BugBlatter
 
I am intentionally using a linear address range in the project:
0x4000...0xffff is addressed with no paging necessary and so runs with maximum efficiency (this is achieved by leaving PPAGE at its initial value of 0x00).
The 0x3d page is then used exclusively by the file system for saving parameters, web pages and other recorded data. The file system manager switches the page in and out when it needs to save or retrieve something.
 
The problem I have with the CodeWarrior debugger is that it automatically erases all FLASH contents when updating code (all pages). This means that it also trashes and data in the file system (for example hardware parameters such as the local MAC address and files such as web pages) and these have to be restored after a software upgrade, making development work rather tedious.
 
I have another downloader which allows me to delete only the pages containing code (in my case it leaves the 0x3d page intakt). Then I can switch back over to the CodeWarrior if I need to debug anything.
 
The CodeWarrior 3.1 had problems with linear memory writing (downloads failed) but this has been solved in the latest V4.5 for HCS12.
 
There remains the minor restriction that (as far as I know) it can not be set up to not delete specific pages. This is a 'minor' CodeWarrior definciency for which there are cures in conjunction with other downloader tools.
 
Regards
 
 
 
0 Kudos