EasyManua.ls Logo

Segger J-Link - Page 394

Segger J-Link
480 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
394 CHAPTER 15 Device specifics
J-Link / J-Trace (UM08001) ©
2004-2017 SEGGER Microcontroller GmbH & Co. KG
On later silicons, this has been corrected. This bug applies to all devices with mask
0M33Z from the 100MHz series.
The J-Link software and documentation package comes with a sample project for the
Kinetis K40 and K60 devices which is pre-configured for the TWR-40 and TWR-60 eval
boards and ETM / ETB Trace. This sample project can be found at
\Sam-
ples\JLink\Projects
.
15.6.1.3 Data flash support
Some devices of the Kinetis family have an additional area called FlexNVM, which can
be configured as data flash. The size of the FlexNVM to be used as data flash is con-
figurable and needs to be configured first, before this area can be used as data flash.
The sample below shows how to configure the FlexNVM area to be used as data flash
out of the target application.
For J-Flash there are also projects that are preconfigured to setup the data flash size
of a Kinetis device. The projects can be found at
$JLINK_INST_DIR$\Sam-
ples\JFlash\ProjectFiles.
One of these sample projects is the
MK40DX256xxx10_ConfigureDataFlash.jflash.
For more information about how configuration of the data flash works, please refer to
the appropriate user manual of the device.
Configure FlexNVM area as data flash
The follwing sample configures the data flash size of Kinetis device. It is created for a
MK40DX256xxx10 device. The sequence is almost the same for all Kinetis devices
only the lines which configure size of the data flash may be modified. In this sample
the data flash is set to max size. EEPROM size is set to 0 bytes.
#define FSTAT (*(volatile unsigned char*)(0x40020000 + 0x00))
#define FCCOB0 (*(volatile unsigned char*)(0x40020000 + 0x07))
#define FCCOB1 (*(volatile unsigned char*)(0x40020000 + 0x06))
#define FCCOB2 (*(volatile unsigned char*)(0x40020000 + 0x05))
#define FCCOB3 (*(volatile unsigned char*)(0x40020000 + 0x04))
#define FCCOB4 (*(volatile unsigned char*)(0x40020000 + 0x0B))
#define FCCOB5 (*(volatile unsigned char*)(0x40020000 + 0x0A))
#define FCCOB6 (*(volatile unsigned char*)(0x40020000 + 0x09))
#define FCCOB7 (*(volatile unsigned char*)(0x40020000 + 0x08))
#define FCCOB8 (*(volatile unsigned char*)(0x40020000 + 0x0F))
void ConfigureDataFlash(void);
*******************************************************************
*
* ConfigureDataFlash
*
* Notes
* Needs to be located in RAM since it performs flash operations
* which make instruction fetching from flash temporarily not possible.
*/
void ConfigureDataFlash(void) {
unsigned char v;
//
// Read out current configuration first
//
FSTAT = 0x70; // Clear error flags in status register
FCCOB0 = 0x03; // Read resource
FCCOB1 = 0x80; // Read from data flash IFR area with offset 0xFC (0x8000FC)
FCCOB2 = 0x00;
FCCOB3 = 0xFC;
FCCOB8 = 0x00; // Select IFR area to be read
FSTAT = 0x80; // Start command execution
while((FSTAT & 0x80) == 0); // Wait until flash controller has finished
//

Table of Contents

Other manuals for Segger J-Link

Related product manuals