/************************************************************************
(c) Copyright 2013-205 Freescale Semiconductor, Inc.
ALL RIGHTS RESERVED.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/* include the header files */
#include "fsl_flash_driver_c90tfs.h"
/*!
* @addtogroup c90tfs_flash_driver
* @{
*/
#define __relocate_code__ __attribute__((section(".relocate_code"), long_call))
/*!
* @name C90TFS Flash driver APIs
* @{
*/
//flash_drv_status_t FlashCommandSequence (PFLASH_SSD_CONFIG pSSDConfig) __relocate_code__;
/*---------------- Function Prototypes for Flash SSD --------------------*/
/*!
* @brief Relocates a function to RAM address.
*
* This function provides a facility to relocate a function in RAM.
*
* @param dest: Destination address where you want to place the function.
* @param size: Size of the function
* @param src: Address of the function will be relocated
* @return Relocated address of the function .
*/
uint32 RelocateFunction(uint32 dest, uint32 size, uint32 src)
{
uint32 temp;
uint16 value, i, *pSrc, *pDest;
temp = PGM2DATA((uint32)src - LAUNCH_COMMAND_OFFSET);
pSrc = (uint16 *)temp;
pDest = (uint16 *)dest;
temp = size >>1;
for (i = 0x0U; i < temp; i++)
{
value = *(uint16 *)(pSrc);
pSrc++;
*(uint16 *)(pDest) = value;
pDest++;
}
return ((uint32)DATA2PGM((uint32)dest + LAUNCH_COMMAND_OFFSET));
//return dest;
}
/*!
* @brief Initializes Flash.
*
* This API initializes Flash module by clearing status error
* bit and reporting the memory configuration via SSD configuration structure.
*
* @param pSSDConfig: The SSD configuration structure pointer.
* @param pFlashCommandSequence : Pointer to the Flash command sequence function.
* @return Successful completion (FTFx_OK)
*/
flash_drv_status_t FlashInit (PFLASH_SSD_CONFIG pSSDConfig, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
{
#if FSL_FEATURE_FLASH_HAS_FLEX_NVM
uint8 EEEDataSetSize; /* store EEE Data Set Size */
uint8 DEPartitionCode; /* store D/E-Flash Partition Code */
flash_drv_status_t ret; /* temporary variable */
/* clear RDCOLERR & ACCERR & FPVIOL flag in flash status register. Write 1 to clear*/
CLEAR_FTFx_FSTAT_ERROR_BITS;
/* Write Command Code to FCCOB0 */
FTFx_FCCOB0 = FTFx_READ_RESOURCE;
/* Write address to FCCOB1/2/3 */
FTFx_FCCOB1 = GET_BIT_16_23(DFLASH_IFR_READRESOURCE_ADDRESS); //0x8003F8U
FTFx_FCCOB2 = GET_BIT_8_15(DFLASH_IFR_READRESOURCE_ADDRESS);
FTFx_FCCOB3 = GET_BIT_0_7(DFLASH_IFR_READRESOURCE_ADDRESS);
/* Write Resource Select Code of 0 to FCCOB8 to select IFR. Without this, */
/* an access error may occur if the register contains data from a previous command. */
/* for FTFE module, resource code is FCCOB4. For others, resource code is FCCOB8 */
FTFx_RSRC_CODE_REG = 0;
ret = pFlashCommandSequence(pSSDConfig);
/* read out EEdata set size and DEpartition code from FCCOBA, FCCOBB for FTFE module, from FCCOB6 and FCCOB7 for others */
#ifdef FTFE
EEEDataSetSize = FTFx_FCCOBA;
DEPartitionCode = FTFx_FCCOBB;
#else
EEEDataSetSize = FTFx_FCCOB6;
DEPartitionCode = FTFx_FCCOB7;
#endif
DEPartitionCode = DEPartitionCode & 0x0FU;
EEEDataSetSize = EEEDataSetSize & 0x0FU;
/* Calculate D-Flash size and EEE size */
if (0x0U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0000;}
else if (0x01U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0001;}
else if (0x02U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0010;}
else if (0x03U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0011;}
else if (0x04U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0100;}
else if (0x05U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0101;}
else if (0x06U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0110;}
else if (0x07U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0111;}
else if (0x08U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1000;}
else if (0x09U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1001;}
else if (0x0AU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1010;}
else if (0x0BU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1011;}
else if (0x0CU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1100;}
else if (0x0DU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1101;}
else if (0x0EU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1110;}
else if (0x0FU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1111;}
else {/* Undefined value */}
if (0x0U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0000;}
else if (0x01U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0001;}
else if (0x02U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0010;}
else if (0x03U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0011;}
else if (0x04U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0100;}
else if (0x05U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0101;}
else if (0x06U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32)FS
没有合适的资源?快使用搜索试试~ 我知道了~
S32K144 bootload
共50个文件
h:22个
c:18个
prefs:3个
3星 · 超过75%的资源 需积分: 37 129 下载量 135 浏览量
2018-01-07
00:05:01
上传
评论 5
收藏 473KB RAR 举报
温馨提示
S32K144 can bootload,操作FLASH, CAN通讯均可实现,,,
资源推荐
资源详情
资源评论
收起资源包目录
S32K144_Bootloader.rar (50个子文件)
S32K144_Bootloader
.settings
com.freescale.s32ds.cross.sdk.support.prefs 160B
language.settings.xml 2KB
org.eclipse.core.resources.prefs 59B
com.processorexpert.core.ide.newprojectwizard.prefs 87B
src
printf.c 18KB
main.c 33KB
io.h 2KB
stdlib.h 2KB
io.c 2KB
.project 795B
.cproject 41KB
Project_Settings
Startup_Code
system_S32K144.c 4KB
startup_S32K144.S 30KB
startup.c 5KB
Linker_Files
S32K144_100_ram.ld 7KB
S32K1xx_flash.ld 7KB
Debugger
S32K144_EVB_Hello_Debug.launch 17KB
Debug
platform
drivers
inc
fsl_lpuart_driver.h 13KB
fsl_flash_driver_c90tfs.h 25KB
src
lpuart
fsl_lpuart_driver.c 30KB
fsl_lpuart_common.c 2KB
fsl_lpuart_irq.c 3KB
flash
fsl_flash_driver_c90tfs.c 76KB
hal
inc
fsl_port_hal.h 18KB
fsl_sim_hal.h 3KB
fsl_scg_hal.h 32KB
fsl_pcc_hal.h 26KB
fsl_gpio_hal.h 7KB
fsl_lpuart_hal.h 44KB
src
scg
fsl_scg_hal.c 33KB
pcc
fsl_pcc_hal.c 13KB
lpuart
fsl_lpuart_hal.c 24KB
sim
S32K144
fsl_sim_hal_S32K144.c 17KB
fsl_sim_hal_S32K144.h 38KB
port
fsl_port_hal.c 3KB
system
inc
fsl_clock_manager.h 13KB
fsl_interrupt_manager.h 5KB
src
interrupt
fsl_interrupt_manager.c 5KB
clock
S32K144
fsl_clock_S32K144.h 3KB
fsl_clock_S32K144.c 8KB
fsl_clock_manager_common.c 2KB
fsl_clock_manager.c 9KB
devices
S32K144
include
S32K144.h 1.21MB
S32K144_features.h 19KB
fsl_bitaccess.h 4KB
Platform_Types.h 6KB
S32K144_extension.h 3.14MB
startup
gcc
system_S32K144.h 5KB
fsl_device_registers.h 3KB
startup.h 2KB
共 50 条
- 1
资源评论
- smofx20132018-03-21不知道可不可以使用
- tybigbird2018-06-06编译出错: Description Resource Path Location Type make: *** No rule to make target `all'. Stop. S32K144_Bootloader C/C++ Problem Description Resource Path Location Type No return, in function returning non-void main.c /S32K144_Bootloader/src line 692 Code Analysis Problem
wzh603571761
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功