luckfox-pico-sdk/sysdrv/source/mcu/rt-thread/libcpu/c-sky/ck802/stack_ck802.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

56 lines
2.6 KiB
C

/*
* File : stack_ck802.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2017-01-01 Urey first version
*/
#include <rtthread.h>
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit)
{
rt_uint32_t *stk = (rt_uint32_t *)stack_addr;
stk = (rt_uint32_t *)(stack_addr + sizeof(rt_uint32_t));
stk = (rt_uint32_t *)RT_ALIGN_DOWN((rt_uint32_t)stk, 8);
*(--stk) = (rt_uint32_t)tentry; /* Entry Point */
*(--stk) = (rt_uint32_t)0x80000150L; /* PSR */
*(--stk) = (rt_uint32_t)texit; /* R15 (LR) (init value will cause fault if ever used) */
*(--stk) = (rt_uint32_t)0x13131313L; /* R13 */
*(--stk) = (rt_uint32_t)0x12121212L; /* R12 */
*(--stk) = (rt_uint32_t)0x11111111L; /* R11 */
*(--stk) = (rt_uint32_t)0x10101010L; /* R10 */
*(--stk) = (rt_uint32_t)0x09090909L; /* R9 */
*(--stk) = (rt_uint32_t)0x08080808L; /* R8 */
*(--stk) = (rt_uint32_t)0x07070707L; /* R7 */
*(--stk) = (rt_uint32_t)0x06060606L; /* R6 */
*(--stk) = (rt_uint32_t)0x05050505L; /* R5 */
*(--stk) = (rt_uint32_t)0x04040404L; /* R4 */
*(--stk) = (rt_uint32_t)0x03030303L; /* R3 */
*(--stk) = (rt_uint32_t)0x02020202L; /* R2 */
*(--stk) = (rt_uint32_t)0x01010101L; /* R1 */
*(--stk) = (rt_uint32_t)parameter; /* R0 : argument */
/* return task's current stack address */
return (rt_uint8_t *)stk;
}