Kinetis readme files

This commit is contained in:
rusefi 2019-07-27 12:46:51 -04:00
parent 81c32fc321
commit 5fc6043a14
8 changed files with 75 additions and 20 deletions

View File

@ -19,7 +19,7 @@
.global Reset_Handler
Reset_Handler:
/* Errata #e10536 workaround for Kinetis MKE1XF:
* "WDOG: After getting RCS assertion by polling, 4 LPO clock-time delay is the minimum requirementbefore the next block"
* "WDOG: After getting RCS assertion by polling, 4 LPO clock-time delay is the minimum requirement before the next block"
* https://www.nxp.com/docs/en/errata/Kinetis_E_0N79P.pdf
* https://community.nxp.com/thread/460264
*/

View File

@ -1352,7 +1352,7 @@ void LPUART_TransferHandleIRQ(LPUART_Type *base, lpuart_handle_t *handle)
uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(base);
/////////////////////////////////////////////////////////////////////////////////////////
// [andreika]: we use this 'fake' unused status to trigger the callback via IRQ in software
// [andreika][rusefi]: we use this 'fake' unused status to trigger the callback via IRQ in software
if (LPUART_STAT_RXINV_MASK & status)
{
base->STAT &= ~LPUART_STAT_RXINV_MASK;

View File

@ -40,6 +40,7 @@
/*===========================================================================*/
// Bootloader config peripheral enable flags
// Bootloader on LPUART & LPSPI, not on CAN
#ifndef BCA_PERIPH
#define BCA_PERIPH ((1<<0) | (1<<2)) /* LPUART | LPSPI */
#endif /* BCA_PERIPH */
@ -66,7 +67,8 @@ const uint8_t _cfm[0x10] = {
0xFF, /* NV_FPROT2: PROT=0xFF */
0xFF, /* NV_FPROT1: PROT=0xFF */
0xFF, /* NV_FPROT0: PROT=0xFF */
/* [andreika]: Warning! These two bytes are extremely important! Don't change them until 100% sure! */
/* [andreika][rusefi]: Warning! These two bytes are extremely important! Don't change them until 100% sure! */
/* there is an opinion that wrong values would brick your Kinetis chip for good */
0x7E, /* NV_FSEC: KEYEN=1,MEEN=3,FSLACC=3,SEC=2 */
0xFB, /* NV_FOPT: BOOTSRC_SEL=1,res=111,RESET_PIN_CFG=1,NMI_DIS=0,BOOTPIN_OPT=1,LPBOOT=1 */

View File

@ -0,0 +1,20 @@
Standard NXP headers
firmware/config/boards/kinetis/OS/os/common/ext/CMSIS/KINETIS
To address Kinetis #e10536 errata we need to sleep 100 cycles to make watchdog happy.
This is taken care by
firmware/config/boards/kinetis/OS/os/common/startup/ARMCMx/compilers/GCC/startup_ke1xf.S
which is executed prior to the default firmware/ChibiOS/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S
Linker script for 512K ROM
firmware/config/boards/kinetis/OS/os/common/startup/ARMCMx/compilers/GCC/ld/MKE1xF512.ld
flash1a & flash1b is some hardware configuration magic
_bca is flash1a via .bcaconfig
_cfm is flash1b via .cfmconfig
firmware/config/boards/kinetis/OS/os/hal/ports/KINETIS/KE1xF/fsl contains Kinetis SDK files with modifications:
1) include hal.h in the beginning
2) firmware/config/boards/kinetis/OS/os/hal/ports/KINETIS/KE1xF/fsl/fsl_lpuart.c has UART patch (see AndreiKA tag)

View File

@ -106,6 +106,13 @@
#define EFI_INTERNAL_FLASH TRUE
/**
* Flex Non Volatile Memory is faster than flash
* It also has smaller pages so it takes less time to erase
*
* There is no remote access to FlexNVM meaning that we cannot erase settings externally
* /
#define FLASH_ADDR 0x10000000 // FlexNVM
#define FLASH_ADDR_SECOND_COPY 0x10008000
@ -296,22 +303,6 @@
#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
/**
* currently ChibiOS uses only first and second channels of each timer for input capture
*
* So, our options are:
*
* TIM2_CH1
* PA5
*
* TIM4_CH1
* PB6
* PD12
*
* TIM9_CH1
* PE5
*/
/**
* Use 'HAL_USE_UART' DMA-mode driver instead of 'HAL_USE_SERIAL'
*

View File

@ -1,5 +1,4 @@
@echo off
set PATH=C:\Program Files\Java\jre\bin;G:\VStudio\Subversion\bin;G:\VStudio\arm-elf-gcc\bin;G:\VStudio\MinGW\msys\1.0\bin;G:\VStudio\Git\bin
rm -f libtinyc.a
arm-none-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mfloat-abi=hard libc_stub.c

View File

@ -0,0 +1,12 @@
Here is the magic here
1) AndreiKA has downloaded libtinyc from somewhere
2) AndreiKA has compiled libtinyc locally
3) AndreiKA has taken some of the .o object files and pasted those here
4) AndreiKA has added his custom libc_stub.c
libtinyc.a is the gcc library produced from all the above mentioned object files
todo: open question where is the official home of libtinyc
This is about wasting as little RAM as possible. Even complete libtinyc wastes some RAM.

View File

@ -0,0 +1,31 @@
rusEfi runs on MKE16F512 (alpha version as of July 2019)
rusEfi Kinetis implementation consists of three files/folders:
firmware/config/boards/kinetis
firmware/hw_layer/ports/kinetis
firmware/hw_layer/trigger_input_comp.cpp
Since MKE16F512 is the first not stm32 rusEfi implementation, AndreiKA has a lot of fun!
Kinetis overrides are in
firmware/config/boards/kinetis/rusefi_hw_enums.h overrides pins
firmware/config/boards/kinetis/config/rusefi_config_kinetis.txt
todo:
have rusefi_stm32_hw_enums.h
have rusefi_kinetis_hw_enums.h
move more generated files to 'generated' folder(s)
maybe generated_stm32?
todo:
move firmware/config/boards/kinetis/config/!gen_enum_to_string.bat somewhere else? merge with stm32?
At the moment we use internal RC generator. Open question if it's good enough.
![pic](https://raw.githubusercontent.com/wiki/rusefi/rusefi_documentation/Hardware/Deucalion/Deucalion_0_1_half_assembled.jpg)
# How to program
Used to be NXP_Kinetis_Bootloader_2_0_0 KinetisFlashTool and it's not clear how to download it now :(
We happen to have https://github.com/rusefi/rusefi_external_utils/raw/master/Kinetis/FSL_Kinetis_Bootloader_2.0.0_repack.zip