Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init Project #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions Doc/01.例程功能说明.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

程序名字: H7-TOOL_boot

功能:
1、按下按键(S键或C键)上电,进入固件升级界面
2、固件升级需要用USB线,虚拟USB串口
3、无按键上电则直接进入APP程序
4、APP程序定位在 : 0x08020000 (1920KB)
5、BOO程序定位在 : 0x08000000 (128KB)
6 changes: 6 additions & 0 deletions Doc/02.例程修改记录.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

----------------------------------------------------------------------------

2019-10-08 V1.00
1.首版
2.固件版本内嵌在向量表 startup_stm32h743xx.s
73 changes: 73 additions & 0 deletions Doc/03.通信协议.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

3. 脱机下载器
- STM32
- EEPROM
- SPI FLASH

-------------------------------------------------------------
64H - 下载LUA程序,支持分包传输
主机发送:
01 ; 站号
64 ; 功能码
0100 0000 ; 总长度 4字节
0000 0000 : 偏移地址 4字节
0020 0000 : 本包数据长度 4字节
xx ... xx : 程序数据,n个
CCCC : CRC16

从机应答:
01 ; 从机地址
64 ; 功能码
00 ; 执行结果,0表示OK 1表示错误
CCCC : CRC16

-------------------------------------------------------------
65H - 执行临时的LUA程序,命令帧带程序
主机发送:
01 ; 从机地址
65 ; 功能码
0100 : 本包数据长度 4字节
xxxx : 数据,0结束
CCCC : CRC16

从机应答:
01 ; 从机地址
65 ; 功能码
00 ; 执行结果,0表示OK 1表示错误
CCCC : CRC16

-------------------------------------------------------------
66H - write file
主机发送:
01 ; 站号
66 ; 功能码
0100 0000 ; 总长度 4字节
0000 0000 : 偏移地址 4字节
0020 0000 : 本包数据长度 4字节
xx ... xx : 数据,n个
CCCC : CRC16

从机应答:
01 ; 从机地址
65 ; 功能码
00 ; 执行结果,0表示OK 1表示错误
CCCC : CRC16

-------------------------------------------------------------
67H - read file
主机发送:
01 ; 站号
67 ; 功能码
0100 0000 ; 总长度 4字节 -- 先保留,好像用不到
0000 0000 : 偏移地址 4字节
0020 0000 : 数据长度 4字节
CCCC : CRC16

从机应答:
01 ; 从机地址
67 ; 功能码
00 ; 执行结果,0表示OK 1表示错误
0000 0000 : 偏移地址 4字节
0000 0000 : 后续数据长度
xxx : 数据体
CCCC : CRC16
37 changes: 37 additions & 0 deletions Doc/04.Lua开发.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
lua 增加调试代码的方法:

lobject.c文件:
const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
#if 1
printf("%s", msg);
#endif

ldebug.c 文件 luaG_runerror 函数,增加printf

lauxlib.c 文件 luaL_error函数,增加printf

ldo.c 文件 luaD_throw 函数 printf("\r\nthrow errcode=%d\r\n", errcode);

lua.h 定义错误代码
#define LUA_ERRRUN 2
#define LUA_ERRSYNTAX 3
#define LUA_ERRMEM 4
#define LUA_ERRGCMM 5
#define LUA_ERRERR 6

一次分配内存不可以大于 MAX_SIZET

*/

/*
luaconf.h 文件对浮点和整数的处理。 缺省64位整数,双精度浮点
default configuration for 64-bit Lua ('long long' and 'double')
*/

luaconf.h
#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
#define LUAL_BUFFERSIZE 8192
#else
#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))
#endif
25,551 changes: 25,551 additions & 0 deletions Libraries/CMSIS/Device/ST/STM32H7xx/Include/stm32h743xx.h

Large diffs are not rendered by default.

25,810 changes: 25,810 additions & 0 deletions Libraries/CMSIS/Device/ST/STM32H7xx/Include/stm32h750xx.h

Large diffs are not rendered by default.

25,811 changes: 25,811 additions & 0 deletions Libraries/CMSIS/Device/ST/STM32H7xx/Include/stm32h753xx.h

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions Libraries/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/**
******************************************************************************
* @file stm32h7xx.h
* @author MCD Application Team
* @brief CMSIS STM32H7xx Device Peripheral Access Layer Header File.
*
* The file is the unique include file that the application programmer
* is using in the C source code, usually in main.c. This file contains:
* - Configuration section that allows to select:
* - The STM32H7xx device used in the target application
* - To use or not the peripheral�s drivers in application code(i.e.
* code will be based on direct access to peripheral�s registers
* rather than drivers API), this option is controlled by
* "#define USE_HAL_DRIVER"
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*
******************************************************************************
*/

/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32h7xx
* @{
*/

#ifndef STM32H7xx_H
#define STM32H7xx_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/** @addtogroup Library_configuration_section
* @{
*/

/**
* @brief STM32 Family
*/
#if !defined (STM32H7)
#define STM32H7
#endif /* STM32H7 */


/* Uncomment the line below according to the target STM32H7 device used in your
application
*/

#if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx)
/* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743II, STM32H743BI, STM32H743XI Devices */
/* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753II, STM32H753BI, STM32H753XI Devices */
/* #define STM32H750xx */ /*!< STM32H750V, STM32H750I, STM32H750X Devices */
#endif

/* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor.
*/
#if !defined (USE_HAL_DRIVER)
/**
* @brief Comment the line below if you will not use the peripherals drivers.
In this case, these drivers will not be included and the application code will
be based on direct access to peripherals registers
*/
/*#define USE_HAL_DRIVER */
#endif /* USE_HAL_DRIVER */

/**
* @brief CMSIS Device version number V1.3.0
*/
#define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
#define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32H7xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC))

/**
* @}
*/

/** @addtogroup Device_Included
* @{
*/

#if defined(STM32H743xx)
#include "stm32h743xx.h"
#elif defined(STM32H753xx)
#include "stm32h753xx.h"
#elif defined(STM32H750xx)
#include "stm32h750xx.h"
#else
#error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)"
#endif

/**
* @}
*/

/** @addtogroup Exported_types
* @{
*/
typedef enum
{
RESET = 0,
SET = !RESET
} FlagStatus, ITStatus;

typedef enum
{
DISABLE = 0,
ENABLE = !DISABLE
} FunctionalState;
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))

typedef enum
{
ERROR = 0,
SUCCESS = !ERROR
} ErrorStatus;

/**
* @}
*/


/** @addtogroup Exported_macros
* @{
*/
#define SET_BIT(REG, BIT) ((REG) |= (BIT))

#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))

#define READ_BIT(REG, BIT) ((REG) & (BIT))

#define CLEAR_REG(REG) ((REG) = (0x0))

#define WRITE_REG(REG, VAL) ((REG) = (VAL))

#define READ_REG(REG) ((REG))

#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))

#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))


/**
* @}
*/

#if defined (USE_HAL_DRIVER)
#include "stm32h7xx_hal.h"
#endif /* USE_HAL_DRIVER */


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* STM32H7xx_H */
/**
* @}
*/

/**
* @}
*/




/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Loading