Browse Source

!34 重构串口驱动模块

pull/35/MERGE
huanghe 3 years ago
committed by zhugengyu
parent
commit
8278a29073
  1. 13
      .gitee/PULL_REQUEST_TEMPLATE.md
  2. 7
      .vscode/settings.json
  3. 2
      README.md
  4. 59
      arch/armv8/aarch32/gcc/exception_debug.c
  5. 38
      arch/armv8/aarch32/gcc/vector.S
  6. 2
      arch/armv8/aarch32/generic_timer.c
  7. 16
      arch/armv8/aarch64/cache.c
  8. 14
      arch/armv8/aarch64/cache.h
  9. 22
      arch/armv8/aarch64/exception.c
  10. 9
      arch/armv8/aarch64/gcc/vector.S
  11. 2
      arch/armv8/aarch64/mmu.c
  12. 47
      baremetal/example/can_test/main.c
  13. 4
      baremetal/example/can_test/sdkconfig
  14. 2
      baremetal/example/can_test/sdkconfig.h
  15. 2
      baremetal/example/fi2c_eeprom/configs/d2000_aarch32_eg_configs
  16. 2
      baremetal/example/fi2c_eeprom/configs/d2000_aarch64_eg_configs
  17. 2
      baremetal/example/fi2c_eeprom/configs/ft2004_aarch32_eg_configs
  18. 2
      baremetal/example/fi2c_eeprom/configs/ft2004_aarch64_eg_configs
  19. 2
      baremetal/example/fi2c_eeprom/sdkconfig
  20. 2
      baremetal/example/fi2c_eeprom/sdkconfig.h
  21. 2
      baremetal/example/fi2c_slave/configs/d2000_aarch32_eg_configs
  22. 2
      baremetal/example/fi2c_slave/configs/d2000_aarch64_eg_configs
  23. 2
      baremetal/example/fi2c_slave/configs/ft2004_aarch32_eg_configs
  24. 2
      baremetal/example/fi2c_slave/configs/ft2004_aarch64_eg_configs
  25. 2
      baremetal/example/fi2c_slave/sdkconfig
  26. 2
      baremetal/example/fi2c_slave/sdkconfig.h
  27. 56
      baremetal/example/fpl011_test/Kconfig
  28. 174
      baremetal/example/fpl011_test/README.md
  29. 121
      baremetal/example/fpl011_test/configs/d2000_aarch32_eg_configs
  30. 120
      baremetal/example/fpl011_test/configs/d2000_aarch64_eg_configs
  31. 121
      baremetal/example/fpl011_test/configs/ft2004_aarch32_eg_configs
  32. 120
      baremetal/example/fpl011_test/configs/ft2004_aarch64_eg_configs
  33. 120
      baremetal/example/fpl011_test/configs/sdkconfig
  34. BIN
      baremetal/example/fpl011_test/figs/实验结果图.png
  35. BIN
      baremetal/example/fpl011_test/figs/裸机测试配置.png
  36. 55
      baremetal/example/fpl011_test/main.c
  37. 23
      baremetal/example/fpl011_test/makefile
  38. 120
      baremetal/example/fpl011_test/sdkconfig
  39. 109
      baremetal/example/fpl011_test/sdkconfig.h
  40. 42
      baremetal/example/fpl011_test/uart_hello_world.c
  41. 115
      baremetal/example/fpl011_test/uart_init.c
  42. 155
      baremetal/example/fpl011_test/uart_intr.c
  43. 85
      baremetal/example/fpl011_test/uart_polled.c
  44. 38
      baremetal/example/fpl011_test/uart_test.h
  45. 40
      baremetal/example/gdma_test/main.c
  46. 2
      baremetal/example/gdma_test/sdkconfig
  47. 2
      baremetal/example/gmac_test/configs/d2000_aarch32_eg_configs
  48. 2
      baremetal/example/gmac_test/configs/d2000_aarch64_eg_configs
  49. 2
      baremetal/example/gmac_test/configs/ft2004_aarch32_eg_configs
  50. 2
      baremetal/example/gmac_test/configs/ft2004_aarch64_eg_configs
  51. 2
      baremetal/example/gmac_test/sdkconfig
  52. 2
      baremetal/example/gmac_test/sdkconfig.h
  53. 2
      baremetal/example/letter_shell_test/configs/d2000_aarch32_eg_configs
  54. 2
      baremetal/example/letter_shell_test/configs/d2000_aarch64_eg_configs
  55. 2
      baremetal/example/letter_shell_test/configs/e2000_aarch32_eg_configs
  56. 2
      baremetal/example/letter_shell_test/configs/e2000_aarch64_eg_configs
  57. 2
      baremetal/example/letter_shell_test/configs/ft2004_aarch32_eg_configs
  58. 2
      baremetal/example/letter_shell_test/configs/ft2004_aarch64_eg_configs
  59. 2
      baremetal/example/letter_shell_test/sdkconfig
  60. 2
      baremetal/example/letter_shell_test/sdkconfig.h
  61. 69
      baremetal/example/letter_shell_test/test_uart.c
  62. 1
      baremetal/example/libmetal_test/README.md
  63. 13
      baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig
  64. 19
      baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig
  65. 26
      baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig
  66. 52
      baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig
  67. 6
      baremetal/example/libmetal_test/core0/configs/d2000_aarch32_eg_configs
  68. 6
      baremetal/example/libmetal_test/core0/configs/d2000_aarch64_eg_configs
  69. 6
      baremetal/example/libmetal_test/core0/configs/ft2004_aarch32_eg_configs
  70. 6
      baremetal/example/libmetal_test/core0/configs/ft2004_aarch64_eg_configs
  71. 7
      baremetal/example/libmetal_test/core0/main.c
  72. 8
      baremetal/example/libmetal_test/core0/makefile
  73. 6
      baremetal/example/libmetal_test/core0/sdkconfig
  74. 6
      baremetal/example/libmetal_test/core0/sdkconfig.h
  75. 19
      baremetal/example/libmetal_test/core1/configs/d2000_aarch32_eg_configs
  76. 17
      baremetal/example/libmetal_test/core1/configs/d2000_aarch64_eg_configs
  77. 19
      baremetal/example/libmetal_test/core1/configs/ft2004_aarch32_eg_configs
  78. 17
      baremetal/example/libmetal_test/core1/configs/ft2004_aarch64_eg_configs
  79. 8
      baremetal/example/libmetal_test/core1/makefile
  80. 17
      baremetal/example/libmetal_test/core1/sdkconfig
  81. 15
      baremetal/example/libmetal_test/core1/sdkconfig.h
  82. 2
      baremetal/example/lwip_test/configs/d2000_aarch32_eg_configs
  83. 2
      baremetal/example/lwip_test/configs/d2000_aarch64_eg_configs
  84. 2
      baremetal/example/lwip_test/configs/ft2004_aarch32_eg_configs
  85. 2
      baremetal/example/lwip_test/configs/ft2004_aarch64_eg_configs
  86. 2
      baremetal/example/lwip_test/sdkconfig
  87. 2
      baremetal/example/lwip_test/sdkconfig.h
  88. 2
      baremetal/example/nand_flash_test/configs/e2000_aarch32_eg_configs
  89. 2
      baremetal/example/nand_flash_test/configs/e2000_aarch64_eg_configs
  90. 2
      baremetal/example/nand_flash_test/sdkconfig
  91. 2
      baremetal/example/nand_flash_test/sdkconfig.h
  92. 2
      baremetal/example/newlibc_test/configs/d2000_aarch32_eg_configs
  93. 2
      baremetal/example/newlibc_test/configs/d2000_aarch64_eg_configs
  94. 2
      baremetal/example/newlibc_test/configs/e2000_aarch32_eg_configs
  95. 2
      baremetal/example/newlibc_test/configs/e2000_aarch64_eg_configs
  96. 2
      baremetal/example/newlibc_test/configs/ft2004_aarch32_eg_configs
  97. 2
      baremetal/example/newlibc_test/configs/ft2004_aarch64_eg_configs
  98. 2
      baremetal/example/newlibc_test/sdkconfig
  99. 2
      baremetal/example/newlibc_test/sdkconfig.h
  100. 398
      baremetal/example/overall_test/cmd_sdio_poll/cmd_verify.c

13
.gitee/PULL_REQUEST_TEMPLATE.md

@ -1,3 +1,16 @@
<!--
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-27 14:34:28
* @LastEditTime: 2021-10-27 14:34:29
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
-->
## 拉取/合并请求描述:
[

7
.vscode/settings.json

@ -178,10 +178,17 @@
"f_sdmmc_hw.h": "c",
"sdio_app.h": "c",
"f_sdio_hw.h": "c",
"time.h": "c",
"errno.h": "c",
"smp.h": "c",
"fpl011.h": "c",
"uart_test.h": "c",
"f_sdio_hw.h": "c",
"fi2c.h": "c",
"i2c_eeprom_example.h": "c",
"fi2c_hw.h": "c",
"fi2c_eeprom_example.h": "c",
"fi2c_slave_example.h": "c"
"aarch32.h": "c"
}
}

2
README.md

@ -1,6 +1,6 @@
# Phytium-Standalone-SDK
**v0.1.8** [ReleaseNote](./doc/ChangeLog.md)
**v0.1.9** [ReleaseNote](./doc/ChangeLog.md)
---

59
arch/armv8/aarch32/gcc/exception_debug.c

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-07-06 08:08:20
* @LastEditTime: 2021-09-18 15:25:17
* @LastEditTime: 2021-10-26 10:25:36
* @Description:  This files is for
*
* @Modify History:
@ -18,67 +18,14 @@
//#define EXCEPTION_DEBUG_ON
#define NO_PRINTF
void FiqDebug()
{
#ifdef EXCEPTION_DEBUG_ON
printf("fiq abort\r\n");
#endif
}
void UdfDebug()
{
#ifdef EXCEPTION_DEBUG_ON
printf("undefine abort\r\n");
#endif
}
void SwiDebug()
{
#ifdef EXCEPTION_DEBUG_ON
printf("software irq abort\r\n");
#endif
}
void PrfDebug()
{
#ifdef EXCEPTION_DEBUG_ON
printf("prefetch abort\r\n");
#endif
}
void DatDebug()
{
#ifdef EXCEPTION_DEBUG_ON
printf("data abort\r\n");
#endif
}
extern void OutByte(s8 byte);
void TraceDebug()
{
#ifdef NO_PRINTF
OutByte('0');
#else
printf("stub \r\n");
#endif
}
void TraceDebug1()
{
#ifdef NO_PRINTF
OutByte('1');
#else
printf("stub 1\r\n");
#endif
}
void TraceDebug2()
void PrintLr(u32 lr)
{
#ifdef NO_PRINTF
OutByte('2');
#else
printf("stub 1\r\n");
#endif
printf("lr is %x \r\n",lr);
}
void TraceSctrl()

38
arch/armv8/aarch32/gcc/vector.S

@ -50,42 +50,46 @@ system_vectors:
.arm
.weak IRQ_Handler
.type IRQ_Handler, %function
@.global IRQ_Handler
.global IRQ_Handler
IRQ_Handler: /* 0x18 IRQ */
push {lr} /* Save return address+4 */
push {r0-r3, r12} /* Push caller save registers */
stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code*/
vpush {d0-d7}
vpush {d16-d31}
vmrs r1, FPSCR
push {r1}
vmrs r1, FPEXC
push {r1}
mrs r0, spsr /* Save SPRS to allow interrupt reentry */
push {r0}
/* Get GIC base address MRC P15, 4, r1, C15, C0, 0 */
//<! get iar
mrc p15, 0, r0, c12, c12, 0
isb
push {r0, r1}
cps #0x13 /* Change to Supervisor mode to allow interrupt reentry */
push {lr} /* Save Supervisor lr */
ldr r2, =SystemIrqHandler
blx r2 /* b irq_debug Call SystemIrqHandler with param GCC */
pop {lr}
bl SystemIrqHandler
pop {lr}
cps #0x12 /* Back to IRQ mode */
pop {r0, r1}
pop {r0}
msr spsr_cxsf, r0
pop {r0-r3, r12}
pop {lr}
subs pc, lr, #4
.size IRQ_Handler, . - IRQ_Handler
pop {r1}
vmsr FPEXC, r1
pop {r1}
vmsr FPSCR, r1
vpop {d16-d31}
vpop {d0-d7}
ldmia sp!,{r0-r3,r12,lr} /* state restore from compiled code */
subs pc, lr, #4 /* adjust return */
.size IRQ_Handler, . - IRQ_Handler
.global Abort_Exception
Abort_Exception:

2
arch/armv8/aarch32/generic_timer.c

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-06-21 14:11:09
* @LastEditTime: 2021-09-06 14:57:37
* @LastEditTime: 2021-10-14 18:42:37
* @Description:  This files is for
*
* @Modify History:

16
arch/armv8/aarch64/cache.c

@ -37,6 +37,22 @@ extern void __asm_invalidate_tlb_all();
#define HNF_STRIDE 0x10000
#endif
void FOuterDisableL3cache(void)
{
int i, pstate;
for (i = 0; i < 8; i++)
FtOut32(0x3A200010 + i * 0x10000,1);
for (i = 0; i < 8; i++) {
do {
pstate = FtIn32(0x3A200018 + i* 0x10000);
} while ((pstate & 0xf) != (0x1<< 2));
}
}
int AsmFlushL3Dcache(void)
{

14
arch/armv8/aarch64/cache.h

@ -1,3 +1,16 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-14 19:30:09
* @LastEditTime: 2021-10-28 13:36:00
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#ifndef BSP_ARCH_AARCH64_CACHE_H
#define BSP_ARCH_AARCH64_CACHE_H
@ -53,4 +66,5 @@ void FCacheICacheEnable(void);
void FCacheICacheDisable(void);
void FCacheICacheInvalidate(void);
#endif

22
arch/armv8/aarch64/exception.c

@ -1,3 +1,16 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-14 19:30:09
* @LastEditTime: 2021-10-29 22:50:57
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include "exception.h"
#include "ft_types.h"
#include "ft_assert.h"
@ -23,12 +36,15 @@ _WEAK void IrqHandleException(void *value)
void CommonTrapHandler(exception_frame *exc)
{
if ((exc->exc_type & 0xff) == AARCH64_EXC_SYNC_SPX)
if ((exc->exc_type & 0xff) == AARCH64_EXC_SERR_SPX)
{
SerrHandle(exc);
}
if ((exc->exc_type & 0xff) == AARCH64_EXC_IRQ_SPX)
else if ((exc->exc_type & 0xff) == AARCH64_EXC_SYNC_SPX)
{
SerrHandle(exc);
}
else if ((exc->exc_type & 0xff) == AARCH64_EXC_IRQ_SPX)
{
IrqHandleException(exc);
}

9
arch/armv8/aarch64/gcc/vector.S

@ -89,6 +89,9 @@
.endm
.macro build_trapframe exc_type
savefloatregister
/*
* store generic registers from (x29,x30) pair to (x1,x2) pair.
*/
@ -108,8 +111,6 @@
stp x3, x4, [sp, #-16]!
stp x1, x2, [sp, #-16]!
savefloatregister
/*
* Store (spsr, x0)
*/
@ -169,7 +170,7 @@
ldp x21, x0, [sp], #16
msr spsr_el1, x21
restorefloatregister
/*
* Restore generic registers from (x29,x30) pair to (x1,x2) pair.
@ -190,6 +191,8 @@
ldp x27, x28, [sp], #16
ldp x29, x30, [sp], #16
restorefloatregister
eret
.endm

2
arch/armv8/aarch64/mmu.c

@ -3,6 +3,7 @@
#include "ft_assert.h"
#include <kernel.h>
#include "mmu.h"
#include "sdkconfig.h"
#define assert FT_ASSERTNONERETURN
/******************************
@ -348,6 +349,7 @@ static void EnableMmuEl1()
ISB();
}
/* ARM MMU Driver Initial Setup */
/*

47
baremetal/example/can_test/main.c

@ -1,46 +1,15 @@
/*
* @Author: your name
* @Date: 2021-09-06 18:18:31
* @LastEditTime: 2021-10-09 20:20:08
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \phytium-standalone-sdk\baremetal\example\can_test\main.c
*/
/*
* @[H]: Copyright (C) 2014-2021 Phytium Technology.  All rights reserved.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  The above copyright notice and this permission notice shall be included in
*  all copies or substantial portions of the Software.
*
*  Use of the Software is limited solely to applications:
*  (a) running on a Phytium device, or
*  (b) that interact with a Phytium device through a bus or interconnect.
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
*  PHYTIUM  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
*  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
*  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*  SOFTWARE.
* Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
*  Except as contained in this notice, the name of the Phytium shall not be used
*  in advertising or otherwise to promote the sale, use or other dealings in
*  this Software without prior written authorization from Phytium. 
* @Date: 2021-07-09 08:08:39
* @LastEditTime: 2021-10-27 14:46:26
* @Description:  This files is for
*
* @Date: 2021-07-12 10:27:46
* @LastEditTime: 2021-07-12 10:27:46
* @Description:  Description of file
* @Modify History:
* * * Ver   Who        Date         Changes
* * ----- ------     --------    --------------------------------------
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include <stdio.h>

4
baremetal/example/can_test/sdkconfig

@ -21,7 +21,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
@ -103,7 +103,7 @@ CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x0400
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option

2
baremetal/example/can_test/sdkconfig.h

@ -89,7 +89,7 @@
#define CONFIG_LINK_SCRIPT_RAM
#define CONFIG_RAM_START_UP_ADDR 0x81000000
#define CONFIG_RAM_SIZE_MB 64
#define CONFIG_HEAP_SIZE 0x0400
#define CONFIG_HEAP_SIZE 0x04000
#define CONFIG_STACK_SIZE 0x1000
/* end of Linker Options */
/* end of Building Option */

2
baremetal/example/fi2c_eeprom/configs/d2000_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/fi2c_eeprom/configs/d2000_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_eeprom/configs/ft2004_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/fi2c_eeprom/configs/ft2004_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="ft2004_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_eeprom/sdkconfig

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_eeprom/sdkconfig.h

@ -14,7 +14,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

2
baremetal/example/fi2c_slave/configs/d2000_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/fi2c_slave/configs/d2000_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_slave/configs/ft2004_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/fi2c_slave/configs/ft2004_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="ft2004_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_slave/sdkconfig

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/fi2c_slave/sdkconfig.h

@ -14,7 +14,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

56
baremetal/example/fpl011_test/Kconfig

@ -0,0 +1,56 @@
mainmenu "Phytium Baremetal Configuration"
menu "Project Configuration"
config TARGET_NAME
string "Build Target Name"
default "baremetal"
help
Build Target name for the demo
choice TEST_UART_ID
prompt "Select UART driver to be initialized"
default TARGET_UART1_ID
help
Select target to be initialized
config TARGET_UART1_ID
bool "Uart1 id"
config TARGET_UART0_ID
bool "Uart0 id"
endchoice # BUILD_TARGET_ARCH_TYPE
config TEST_UART_BAUDRATE
int "Uart baudrate select"
default "115200"
help
Assign uart baudrate in this example
config TEST_UART_DATA_BIT_LENGTH
int "Number of data bits"
default "8"
help
Target data bits has to be between 8 and 5
choice TEST_UART_PARITY
prompt "Select UART parity to be initialized"
default TARGET_UART_NO_PARITY
help
Select target to be initialized
config TARGET_UART_NO_PARITY
bool "No parity"
config TARGET_UART_EVEN_PARITY
bool "Even parity"
config TARGET_UART_ODD_PARITY
bool "Odd parity"
endchoice # BUILD_TARGET_ARCH_TYPE
config TEST_UART_STOP_BIT_LENGTH
int "Number of stop bits"
default "1"
help
Target stop bits has to be between 2 and 1
endmenu
source "$(STANDALONE_SDK_ROOT)/Kconfig"

174
baremetal/example/fpl011_test/README.md

@ -0,0 +1,174 @@
<!--
* @Author: your name
* @Date: 2021-09-06 08:43:35
* @LastEditTime: 2021-10-27 14:37:32
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \phytium-standalone-sdk\baremetal\example\libmetal_test\README.md
-->
<!--
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-08-27 10:37:27
* @LastEditTime: 2021-09-03 14:19:17
* @Description: This files is for
*
* @Modify History:
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------
-->
# uart 测试
## 1. 例程介绍
><font size="1">介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作</font><br />
1. 基于 串口驱动
2. 基于loopback模式对 串口0 驱动的轮询与中断接收发送模式进行测试
## 2. 如何使用例程
><font size="1">描述开发平台准备,使用例程配置,构建和下载镜像的过程</font><br />
### 2.1 硬件配置方法
><font size="1">哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)</font><br />
1. 准备一块ft2000/4 或者d2000 开发板
2. 将串口连接好电脑,波特率设为 115200-8-1-N
### 2.2 SDK配置方法
><font size="1">依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)</font><br />
- 本例子已经提供好具体的编译指令,以下进行介绍:
1. make clean 清理已经编译好的工程
2. make 编译例程代码
3. make boot 将编译好的测试bin和elf 文件,拷贝至$(USR_BOOT_DIR) 变量的路径下
4. make config_d2000_aarch64_default 将预设64bit d2000 下的配置加载至工程例子中
5. make config_d2000_aarch32_default 将预设32bit d2000 下的配置加载至工程例子中
6. make config_ft2004_aarch64_default 将预设64bit ft2004 下的配置加载至工程例子中
7. make config_ft2004_aarch32_default 将预设32bit ft2004 下的配置加载至工程例子中
- 具体使用方法为:
- 在baremetal/example/uart_test/ 下
- make + 以上指令
### 2.3 构建和下载
><font size="1">描述构建、烧录下载镜像的过程,列出相关的命令</font><br />
#### 工程下makefile 介绍
```
# 指定工程项目根目录为当前(只能指定一个目录)
export PROJECT_DIR ?= .
# 用户添加的源文件夹和头文件夹(可以指定多个)
export USR_SRC_DIR ?= .
export USR_INC_DIR ?= .
# 用户定义的编译目标文件上传路径
USR_BOOT_DIR ?= /mnt/d/tftboot/
# 设置启动镜像名
BOOT_IMG_NAME ?= baremetal
# 指定编译freertos项目使用的makefile
include $(STANDALONE_SDK_ROOT)/make/build_baremetal.mk
.PHONY: boot config_d2000_aarch64_default config_d2000_aarch32_default config_ft2004_aarch32_default config_ft2004_aarch64_default
load_d2000_aarch64_default:
@cp $(PROJECT_DIR)/default_config/d2000_aarch64_sdkconfig \
./$(KCONFIG_CONFIG) -f
load_d2000_aarch32_default:
@cp $(PROJECT_DIR)/default_config/d2000_aarch32_sdkconfig \
./$(KCONFIG_CONFIG) -f
load_ft2004_aarch64_default:
@cp $(PROJECT_DIR)/default_config/ft2004_aarch64_sdkconfig \
./$(KCONFIG_CONFIG) -f
load_ft2004_aarch32_default:
@cp $(PROJECT_DIR)/default_config/ft2004_aarch32_sdkconfig \
./$(KCONFIG_CONFIG) -f
# 完成编译
boot:
make -j
@cp ./$(CONFIG_TARGET_NAME).elf $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf
@cp ./$(CONFIG_TARGET_NAME).bin $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).bin
config_d2000_aarch64_default: load_d2000_aarch64_default genconfig clean
config_d2000_aarch32_default: load_d2000_aarch32_default genconfig clean
config_ft2004_aarch64_default: load_ft2004_aarch64_default genconfig clean
config_ft2004_aarch32_default: load_ft2004_aarch32_default genconfig clean
```
其中 USR_BOOT_DIR 变量,用户可以自定义结果文件输出的位置
其中 BOOT_IMG_NAME 变量,用户可以自定义结果文件自己的命名
#### 工程自定义配置
![](./figs/裸机测试配置.png)
### 2.4 输出与实验现象
><font size="1">描述输入输出情况,列出存在哪些输入,对应的输出是什么(建议附录相关现象图片)</font><br />
#### 编译操作步骤
1. 在开发环境下搭建好tftp 环境
2. 切换至工程所在目录
3. 根据需求,使用 'make config_xxxx_aarchxx_default' 切换至目标芯片与工作模式
4. 使用make clean 命令清空当前工程
5. 执行make boot 对所有工程进行编译,并且输出目标文件
#### 开发板载入步骤
```
setenv ipaddr 192.168.4.20 /* 设置开发板上ip */
setenv serverip 192.168.4.50 /* 设置目标tftp服务器ip */
setenv gatewayip 192.168.4.1 /* 设置网关ip */
tftpboot f0000000 baremetal.elf /* 通过tftp通信,将例程中 elf 拷贝至内存中 */
bootelf -p f0000000 /* 加载代码 */
```
- 运行结果如下:
![](./figs/实验结果图.png)
- Select UART driver to be initialized 可以选择那个串口驱动进行实例,并且用它进行实验
- Uart baudrate select 填入串口驱动的目标波特率
- Number of data bits 位域长度
- Select UART parity to be initialized 校验方式选择
- Number of stop bits 停止域的位数
## 3. 如何解决问题 (Q&A)
><font size="1">主要记录使用例程中可能会遇到的问题,给出相应的解决方案</font><br />
## 4. api 指南
[pl011](../../../doc/reference/driver/fpl011.md)
## 5. 修改历史记录
><font size="1">记录例程的重大修改记录,标明修改发生的版本号 </font><br />
- 2021-10-16 : v0.1.1 增加中断与轮询两种实现

121
baremetal/example/fpl011_test/configs/d2000_aarch32_eg_configs

@ -0,0 +1,121 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="d2000_baremetal_a32"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
# end of Arch Configuration
#
# Board Configuration
#
# CONFIG_TARGET_F2000_4 is not set
# CONFIG_TARGET_E2000 is not set
CONFIG_TARGET_D2000=y
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
CONFIG_AARCH32_RAM_LD=y
# CONFIG_AARCH64_RAM_LD is not set
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

120
baremetal/example/fpl011_test/configs/d2000_aarch64_eg_configs

@ -0,0 +1,120 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="d2000_baremetal_a64"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
#
# Board Configuration
#
# CONFIG_TARGET_F2000_4 is not set
# CONFIG_TARGET_E2000 is not set
CONFIG_TARGET_D2000=y
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

121
baremetal/example/fpl011_test/configs/ft2004_aarch32_eg_configs

@ -0,0 +1,121 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="FT2004_baremetal_a32"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
# end of Arch Configuration
#
# Board Configuration
#
CONFIG_TARGET_F2000_4=y
# CONFIG_TARGET_E2000 is not set
# CONFIG_TARGET_D2000
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
CONFIG_AARCH32_RAM_LD=y
# CONFIG_AARCH64_RAM_LD is not set
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

120
baremetal/example/fpl011_test/configs/ft2004_aarch64_eg_configs

@ -0,0 +1,120 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="FT2004_baremetal_a64"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
#
# Board Configuration
#
CONFIG_TARGET_F2000_4=y
# CONFIG_TARGET_E2000 is not set
# CONFIG_TARGET_D2000
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

120
baremetal/example/fpl011_test/configs/sdkconfig

@ -0,0 +1,120 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="FT2004_baremetal_a64"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
#
# Board Configuration
#
CONFIG_TARGET_F2000_4=y
# CONFIG_TARGET_E2000 is not set
# CONFIG_TARGET_D2000 is not set
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

BIN
baremetal/example/fpl011_test/figs/实验结果图.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
baremetal/example/fpl011_test/figs/裸机测试配置.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

55
baremetal/example/fpl011_test/main.c

@ -0,0 +1,55 @@
/*
* Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-07-09 08:08:39
* @LastEditTime: 2021-10-26 15:43:57
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include <stdio.h>
#include "uart_test.h"
#include "ft_error_code.h"
#include "ft_debug.h"
#define UART_TEST_TEST_DEBUG_TAG "UART_TEST_TEST"
#define UART_TEST_TEST_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(UART_TEST_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define UART_TEST_TEST_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(UART_TEST_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define UART_TEST_TEST_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(UART_TEST_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
int main()
{
FError ret;
ret = TestUartInit();
if(ret != FT_SUCCESS)
{
UART_TEST_TEST_DEBUG_E("TestUartInit is error");
return 0;
}
UartHelloWorld(&uart_p);
ret = UartPolled(&uart_p);
if(ret != FT_SUCCESS)
{
UART_TEST_TEST_DEBUG_E("UartPolled is error");
return 0;
}
ret = UartIntr(&uart_p);
if(ret != FT_SUCCESS)
{
UART_TEST_TEST_DEBUG_E("UartIntr is error");
return 0;
}
printf("test is finished \r\n");
return 0;
}

23
baremetal/example/uart_test/makefile → baremetal/example/fpl011_test/makefile

@ -1,10 +1,8 @@
# 指定工程项目根目录为当前(只能指定一个目录)
export PROJECT_DIR ?= .
# 用户添加的源文件夹和头文件夹(可以指定多个)
export USR_SRC_DIR ?= . \
./src
export USR_INC_DIR ?= . \
./inc
export USR_SRC_DIR ?= .
export USR_INC_DIR ?= .
# 用户定义的编译目标文件上传路径
USR_BOOT_DIR ?= /mnt/d/tftboot/
@ -15,8 +13,21 @@ BOOT_IMG_NAME ?= baremetal
# 指定编译freertos项目使用的makefile
include $(STANDALONE_SDK_ROOT)/make/build_baremetal.mk
.PHONY: boot build_all
# 完成编译
boot:
make
make -j
@cp ./$(CONFIG_TARGET_NAME).elf $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf
@cp ./$(CONFIG_TARGET_NAME).bin $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).bin
@cp ./$(CONFIG_TARGET_NAME).bin $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).bin
# 编译所有支持的平台
build_all:
make build_ft2004_aarch32
make build_ft2004_aarch64
make build_d2000_aarch32
make build_d2000_aarch64

120
baremetal/example/fpl011_test/sdkconfig

@ -0,0 +1,120 @@
#
# Project Configuration
#
CONFIG_TARGET_NAME="d2000_baremetal_a64"
# CONFIG_TARGET_UART1_ID is not set
CONFIG_TARGET_UART0_ID=y
CONFIG_TEST_UART_BAUDRATE=115200
CONFIG_TEST_UART_DATA_BIT_LENGTH=8
CONFIG_TARGET_UART_NO_PARITY=y
# CONFIG_TARGET_UART_EVEN_PARITY is not set
# CONFIG_TARGET_UART_ODD_PARITY is not set
CONFIG_TEST_UART_STOP_BIT_LENGTH=1
# end of Project Configuration
#
# Platform Setting
#
#
# Arch Configuration
#
# CONFIG_TARGET_ARMV8_AARCH32 is not set
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
#
# Board Configuration
#
# CONFIG_TARGET_F2000_4 is not set
# CONFIG_TARGET_E2000 is not set
CONFIG_TARGET_D2000=y
# end of Board Configuration
#
# Components Configuration
#
# CONFIG_USE_SPI is not set
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
# CONFIG_USE_CAN is not set
# CONFIG_USE_I2C is not set
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Platform Setting
#
# Building Option
#
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
# Linker Options
#
# CONFIG_AARCH32_RAM_LD is not set
CONFIG_AARCH64_RAM_LD=y
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x81000000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x04000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
#
# Library Configuration
#
# CONFIG_USE_G_LIBC is not set
CONFIG_USE_NEW_LIBC=y
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
# CONFIG_USE_AMP is not set
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

109
baremetal/example/fpl011_test/sdkconfig.h

@ -0,0 +1,109 @@
#ifndef SDK_CONFIG_H__
#define SDK_CONFIG_H__
/* Project Configuration */
#define CONFIG_TARGET_NAME "d2000_baremetal_a64"
/* CONFIG_TARGET_UART1_ID is not set */
#define CONFIG_TARGET_UART0_ID
#define CONFIG_TEST_UART_BAUDRATE 115200
#define CONFIG_TEST_UART_DATA_BIT_LENGTH 8
#define CONFIG_TARGET_UART_NO_PARITY
/* CONFIG_TARGET_UART_EVEN_PARITY is not set */
/* CONFIG_TARGET_UART_ODD_PARITY is not set */
#define CONFIG_TEST_UART_STOP_BIT_LENGTH 1
/* end of Project Configuration */
/* Platform Setting */
/* Arch Configuration */
/* CONFIG_TARGET_ARMV8_AARCH32 is not set */
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */
/* Board Configuration */
/* CONFIG_TARGET_F2000_4 is not set */
/* CONFIG_TARGET_E2000 is not set */
#define CONFIG_TARGET_D2000
/* end of Board Configuration */
/* Components Configuration */
/* CONFIG_USE_SPI is not set */
/* CONFIG_USE_QSPI is not set */
#define CONFIG_USE_GIC
#define CONFIG_EBABLE_GICV3
#define CONFIG_USE_SERIAL
/* Usart Configuration */
#define CONFIG_ENABLE_Pl011_UART
/* end of Usart Configuration */
/* CONFIG_USE_GPIO is not set */
/* CONFIG_USE_IOMUX is not set */
/* CONFIG_USE_ETH is not set */
/* CONFIG_USE_CAN is not set */
/* CONFIG_USE_I2C is not set */
/* CONFIG_USE_TIMER is not set */
/* CONFIG_USE_SDMMC is not set */
/* CONFIG_USE_PCIE is not set */
/* CONFIG_USE_WDT is not set */
/* CONFIG_USE_DMA is not set */
/* CONFIG_USE_NAND is not set */
/* end of Components Configuration */
/* end of Platform Setting */
/* Building Option */
/* Cross-Compiler Setting */
#define CONFIG_COMPILER_NO_STD_STARUP
/* CONFIG_USE_EXT_COMPILER is not set */
/* end of Cross-Compiler Setting */
#define CONFIG_LOG_VERBOS
/* CONFIG_LOG_DEBUG is not set */
/* CONFIG_LOG_INFO is not set */
/* CONFIG_LOG_WARN is not set */
/* CONFIG_LOG_ERROR is not set */
/* CONFIG_LOG_NONE is not set */
/* Linker Options */
/* CONFIG_AARCH32_RAM_LD is not set */
#define CONFIG_AARCH64_RAM_LD
/* CONFIG_QEMU_AARCH32_RAM_LD is not set */
/* CONFIG_USER_DEFINED_LD is not set */
#define CONFIG_LINK_SCRIPT_ROM
#define CONFIG_ROM_START_UP_ADDR 0x80100000
#define CONFIG_ROM_SIZE_MB 1
#define CONFIG_LINK_SCRIPT_RAM
#define CONFIG_RAM_START_UP_ADDR 0x81000000
#define CONFIG_RAM_SIZE_MB 64
#define CONFIG_HEAP_SIZE 0x04000
#define CONFIG_STACK_TOP_ADDR 0x82000000
/* end of Linker Options */
/* end of Building Option */
/* Library Configuration */
/* CONFIG_USE_G_LIBC is not set */
#define CONFIG_USE_NEW_LIBC
/* end of Library Configuration */
/* Third-Party Configuration */
/* CONFIG_USE_LWIP is not set */
/* CONFIG_USE_LETTER_SHELL is not set */
/* CONFIG_USE_AMP is not set */
/* CONFIG_USE_YAFFS2 is not set */
/* CONFIG_USE_SDMMC_CMD is not set */
/* end of Third-Party Configuration */
#endif

42
baremetal/example/fpl011_test/uart_hello_world.c

@ -0,0 +1,42 @@
/*
* Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-08-27 10:49:10
* @LastEditTime: 2021-10-26 09:15:21
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include "ft_types.h"
#include "fpl011.h"
#include "stdio.h"
#include "ft_debug.h"
#include <string.h>
#define HELLO_TEST_DEBUG_TAG "HELLO_TEST"
#define HELLO_TEST_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(HELLO_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define HELLO_TEST_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(HELLO_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define HELLO_TEST_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(HELLO_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
void UartHelloWorld(FPl011 *uart_p)
{
u8 HelloWorld[] = "Hello World";
u32 i = 0;
while (i < (sizeof(HelloWorld) - 1)) {
/* Transmit the data */
i += FPl011Send(uart_p,
&HelloWorld[i], 1);
}
HELLO_TEST_DEBUG_I("uart_hello_world is passed ");
}

115
baremetal/example/fpl011_test/uart_init.c

@ -0,0 +1,115 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-18 19:32:46
* @LastEditTime: 2021-10-26 09:16:12
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include "fpl011.h"
#include "ft_error_code.h"
#include "ft_debug.h"
#include "parameters.h"
#include <string.h>
#define UART_INIT_TEST_DEBUG_TAG "UART_INIT_TEST"
#define UART_INIT_TEST_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(UART_INIT_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define UART_INIT_TEST_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(UART_INIT_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define UART_INIT_TEST_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(UART_INIT_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#ifdef CONFIG_TARGET_UART1_ID
#define UART_SELECT_TARGET FUART1_ID
#endif
#ifdef CONFIG_TARGET_UART0_ID
#define UART_SELECT_TARGET FUART0_ID
#endif
FPl011 uart_p;
FPl011Format format;
FError TestUartInit(void)
{
FPl011Config config_value;
const FPl011Config *config_p;
FError ret;
config_p = FPl011LookupConfig(UART_SELECT_TARGET);
if (NULL == config_p)
{
UART_INIT_TEST_DEBUG_E("Lookup ID is error ");
return ERR_GENERAL;
}
memcpy(&config_value,config_p,sizeof(FPl011Config)) ;
ret = FPl011CfgInitialize(&uart_p,&config_value);
if(ret != FT_SUCCESS)
{
UART_INIT_TEST_DEBUG_E("Uart initialize is error ");
return ERR_GENERAL;
}
format.baudrate = CONFIG_TEST_UART_BAUDRATE; /* In bps, ie 1200 */
switch(CONFIG_TEST_UART_DATA_BIT_LENGTH)
{
case 8:
format.data_bits = FPL011_FORMAT_WORDLENGTH_8BIT;
break;
case 7:
format.data_bits = FPL011_FORMAT_WORDLENGTH_7BIT;
break;
case 6:
format.data_bits = FPL011_FORMAT_WORDLENGTH_6BIT;
break;
case 5:
format.data_bits = FPL011_FORMAT_WORDLENGTH_5BIT;
break;
default:
format.data_bits = FPL011_FORMAT_WORDLENGTH_8BIT;
break;
}
#if defined(CONFIG_TARGET_UART_NO_PARITY)
format.parity = FPL011_FORMAT_NO_PARITY;
#elif defined(CONFIG_TARGET_UART_EVEN_PARITY)
format.parity = (FPL011_FORMAT_EN_PARITY | FPL011_FORMAT_EVEN_PARITY);
#elif defined(CONFIG_TARGET_UART_ODD_PARITY)
format.parity = (FPL011_FORMAT_EN_PARITY | FPL011_FORMAT_ODD_PARITY);
#else
format.parity = FPL011_FORMAT_NO_PARITY;
#endif
switch(CONFIG_TEST_UART_STOP_BIT_LENGTH)
{
case 1:
format.stopbits = FPL011_FORMAT_1_STOP_BIT;
break;
case 2:
format.stopbits = FPL011_FORMAT_2_STOP_BIT;
break;
default:
format.stopbits = FPL011_FORMAT_1_STOP_BIT;
break;
}
ret = FPl011SetDataFormat(&uart_p,&format);
if(ret != FT_SUCCESS)
{
UART_INIT_TEST_DEBUG_E("Pl011SetDataFormat is error ");
return ERR_GENERAL;
}
/* Start Uart */
FPl011SetOptions(&uart_p,FPL011_OPTION_UARTEN|FPL011_OPTION_RXEN|FPL011_OPTION_TXEN|FPL011_OPTION_DTR|FPL011_OPTION_RTS);
UART_INIT_TEST_DEBUG_I("TestUartInit is ok");
return FT_SUCCESS;
}

155
baremetal/example/fpl011_test/uart_intr.c

@ -0,0 +1,155 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-20 16:33:37
* @LastEditTime: 2021-10-26 11:31:46
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include "Fpl011.h"
#include "Fpl011_hw.h"
#include "interrupt.h"
#include "ft_error_code.h"
#include "ft_debug.h"
#include "fsleep.h"
#include "parameters.h"
#include "ft_debug.h"
#include <string.h>
#define INTR_TEST_DEBUG_TAG "INTR_TEST"
#define INTR_TEST_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(INTR_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define INTR_TEST_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(INTR_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define INTR_TEST_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(INTR_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
/*
* The following constant controls the length of the buffers to be sent
* and received with the UART,
*/
#define TEST_BUFFER_SIZE 60
/*
* The following buffers are used in this example to send and receive data
* with the UART.
*/
static u8 send_buffer[TEST_BUFFER_SIZE]; /* Buffer for Transmitting Data */
static u8 recv_buffer[TEST_BUFFER_SIZE]; /* Buffer for Receiving Data */
/*
* The following counters are used to determine when the entire buffer has
* been sent and received.
*/
volatile int total_received_count;
volatile int total_sent_count;
int total_error_count;
static void IntrTestHandler(void *args, u32 event, u32 event_data)
{
/* All of the data has been sent */
if (event == FPL011_EVENT_SENT_DATA) {
total_sent_count = event_data;
}
/* All of the data has been received */
if (event == FPL011_EVENT_RECV_DATA) {
total_received_count = event_data;
}
/*
* Data was received, but not the expected number of bytes, a
* timeout just indicates the data stopped for 8 character times
*/
if (event == FPL011_EVENT_RECV_TOUT) {
total_received_count = event_data;
}
/*
* Data was received with an error, keep the data but determine
* what kind of errors occurred
*/
if (event == FPL011_EVENT_RECV_ERROR) {
total_received_count = event_data;
total_error_count++;
}
/*
* Data was received with an parity or frame or break error, keep the data
* but determine what kind of errors occurred. Specific to Zynq Ultrascale+
* MP.
*/
if (event == FPL011_EVENT_PARE_FRAME_BRKE) {
total_received_count = event_data;
total_error_count++;
}
/*
* Data was received with an overrun error, keep the data but determine
* what kind of errors occurred. Specific to Zynq Ultrascale+ MP.
*/
if (event == FPL011_EVENT_RECV_ERROR) {
total_received_count = event_data;
total_error_count++;
}
}
FError UartIntr(FPl011 *uart_p)
{
u32 intr_mask;
int i;
int bad_byte_count = 0;
InterruptInstall(uart_p->config.irq_num, (IrqHandler)FPl011InterruptHandler, uart_p, "uart");
InterruptUmask(uart_p->config.irq_num);
FPl011SetHandler(uart_p, IntrTestHandler, NULL);
FPl011SetRxFifoThreadhold(uart_p,FPL011IFLS_RXIFLSEL_1_4);
FPl011SetTxFifoThreadHold(uart_p,FPL011IFLS_TXIFLSEL_1_2);
intr_mask = (FPL011IMSC_RXIM |
FPL011IMSC_TXIM |
FPL011IMSC_RTIM |
FPL011IMSC_FEIM |
FPL011IMSC_PEIM |
FPL011IMSC_BEIM |
FPL011IMSC_OEIM);
FPl011SetInterruptMask(uart_p,intr_mask);
/* Use local loopback mode. */
FPl011SetOperMode(uart_p, FPL011_OPER_MODE_LOCAL_LOOP);
for (i = 0; i < TEST_BUFFER_SIZE; i++) {
send_buffer[i] = (i % 26) + 'A';
recv_buffer[i] = 0;
}
FPl011Receive(uart_p,recv_buffer,TEST_BUFFER_SIZE);
FPl011Send(uart_p, send_buffer, TEST_BUFFER_SIZE);
while ((total_error_count == 0) && ((total_sent_count != TEST_BUFFER_SIZE)|| (total_received_count != TEST_BUFFER_SIZE)))
;
for (i = 0; i < TEST_BUFFER_SIZE; i++)
{
if (recv_buffer[i] != send_buffer[i]) {
bad_byte_count++;
}
}
FPl011SetOperMode(uart_p, FPL011_OPER_MODE_NORMAL);
FPl011SetInterruptMask(uart_p,~intr_mask);
if (bad_byte_count != 0) {
INTR_TEST_DEBUG_E("uart_intr is error %d \r\n",bad_byte_count);
return ERR_GENERAL;
}
INTR_TEST_DEBUG_I("uart_intr is ok");
return FT_SUCCESS;
}

85
baremetal/example/fpl011_test/uart_polled.c

@ -0,0 +1,85 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-19 13:42:58
* @LastEditTime: 2021-10-26 15:47:11
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include "fpl011.h"
#include "fpl011_hw.h"
#include "ft_error_code.h"
#include "ft_debug.h"
#include "parameters.h"
#include "ft_debug.h"
#include <string.h>
#define POLLED_TEST_DEBUG_TAG "POLLED_TEST"
#define POLLED_TEST_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(POLLED_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define POLLED_TEST_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(POLLED_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define POLLED_TEST_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(POLLED_TEST_DEBUG_TAG, format, ##__VA_ARGS__)
#define TEST_BUFFER_SIZE 10
/*
* The following buffers are used in this example to send and receive data
* with the UART.
*/
static u8 send_buffer[TEST_BUFFER_SIZE]; /* Buffer for Transmitting Data */
static u8 recv_buffer[TEST_BUFFER_SIZE]; /* Buffer for Receiving Data */
FError UartPolled(FPl011 *uart_p)
{
int i = 0;
u32 total_send_count ,recv_count,bad_byte_count = 0;
/* Use local loopback mode. */
FPl011SetOperMode(uart_p, FPL011_OPER_MODE_LOCAL_LOOP);
for (i = 0; i < TEST_BUFFER_SIZE; i++)
{
send_buffer[i] = (i % 26) + 'A';
recv_buffer[i] = 0;
}
total_send_count = FPl011Send(uart_p, send_buffer, TEST_BUFFER_SIZE);
while (FUART_ISTRANSMITBUSY(uart_p->config.base_address))
;
if(total_send_count != TEST_BUFFER_SIZE)
{
POLLED_TEST_DEBUG_E("Polled send is error %d",total_send_count);
return ERR_GENERAL;
}
recv_count = 0;
while (recv_count < TEST_BUFFER_SIZE)
{
recv_count += FPl011Receive(uart_p,&recv_buffer[recv_count],(TEST_BUFFER_SIZE - recv_count));
}
/* Verify the entire receive buffer was successfully received */
for (i = 0; i < TEST_BUFFER_SIZE;i++)
{
if(recv_buffer[i] != send_buffer[i])
{
bad_byte_count++;
}
}
/* Set the UART in Normal Mode */
FPl011SetOperMode(uart_p, FPL011_OPER_MODE_NORMAL);
if(bad_byte_count != 0)
{
POLLED_TEST_DEBUG_E("uart_polled recv is error ");
return ERR_GENERAL;
}
POLLED_TEST_DEBUG_I("uart_polled is ok ");
return ERR_SUCCESS;
}

38
baremetal/example/fpl011_test/uart_test.h

@ -0,0 +1,38 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-10-26 13:45:50
* @LastEditTime: 2021-10-26 13:49:51
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#ifndef BAREMETAL_EXAMPLE_UART_TEST
#define BAREMETAL_EXAMPLE_UART_TEST
#ifdef __cplusplus
extern "C"
{
#endif
#include "ft_error_code.h"
#include "fpl011.h"
extern FPl011 uart_p;
extern FError TestUartInit(void);
extern FError UartIntr(FPl011 *uart_p);
extern FError UartPolled(FPl011 *uart_p);
extern void UartHelloWorld(FPl011 *uart_p);
#ifdef __cplusplus
}
#endif
#endif

40
baremetal/example/gdma_test/main.c

@ -1,40 +1,16 @@
/*
* @[H]: Copyright (C) 2014-2021 Phytium Technology.  All rights reserved.
* Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
* @Date: 2021-07-09 08:08:39
* @LastEditTime: 2021-10-14 15:29:58
* @Description:  This files is for
*
*  The above copyright notice and this permission notice shall be included in
*  all copies or substantial portions of the Software.
*
*  Use of the Software is limited solely to applications:
*  (a) running on a Phytium device, or
*  (b) that interact with a Phytium device through a bus or interconnect.
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
*  PHYTIUM  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
*  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
*  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*  SOFTWARE.
*
*  Except as contained in this notice, the name of the Phytium shall not be used
*  in advertising or otherwise to promote the sale, use or other dealings in
*  this Software without prior written authorization from Phytium. 
*
* @Date: 2021-07-12 10:27:46
* @LastEditTime: 2021-07-12 10:27:46
* @Description:  Description of file
* @Modify History:
* * * Ver   Who        Date         Changes
* * ----- ------     --------    --------------------------------------
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include <stdio.h>
#include "sdkconfig.h"
#include "ft_types.h"

2
baremetal/example/gdma_test/sdkconfig

@ -28,7 +28,7 @@ CONFIG_GDMA_BDL_MODE=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/gmac_test/configs/d2000_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/gmac_test/configs/d2000_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/gmac_test/configs/ft2004_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/gmac_test/configs/ft2004_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="ft2004_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/gmac_test/sdkconfig

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/gmac_test/sdkconfig.h

@ -14,7 +14,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

2
baremetal/example/letter_shell_test/configs/d2000_aarch32_eg_configs

@ -18,7 +18,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/letter_shell_test/configs/d2000_aarch64_eg_configs

@ -18,7 +18,7 @@ CONFIG_SHELL_START_UP_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/letter_shell_test/configs/e2000_aarch32_eg_configs

@ -18,7 +18,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/letter_shell_test/configs/e2000_aarch64_eg_configs

@ -18,7 +18,7 @@ CONFIG_SHELL_START_UP_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/letter_shell_test/configs/ft2004_aarch32_eg_configs

@ -18,7 +18,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/letter_shell_test/configs/ft2004_aarch64_eg_configs

@ -18,7 +18,7 @@ CONFIG_SHELL_START_UP_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/letter_shell_test/sdkconfig

@ -18,7 +18,7 @@ CONFIG_SHELL_START_UP_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/letter_shell_test/sdkconfig.h

@ -16,7 +16,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

69
baremetal/example/letter_shell_test/test_uart.c

@ -1,69 +0,0 @@
/*
* Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-08-30 08:25:47
* @LastEditTime: 2021-09-06 14:55:11
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include <stdio.h>
#include "parameters.h"
#include "pl011_uart.h"
// #include "gicv3.h"
#include "interrupt.h"
Pl011 pl011_obj;
volatile u32 get_uart_rx_flg = 0;
volatile u8 set_irq_priority = 50;
static void UartIrqCallback(void *args, u32 event, u32 event_data)
{
get_uart_rx_flg = 1;
Pl011IrqClearReciveTimeOut(&pl011_obj);
}
static void UartIrqHandler(s32 vector, void *param)
{
Pl011InterruptHandler(param);
}
void UartInit(void)
{
Pl011Config config = *Pl011LookupConfig(FT_UART1_ID);
Pl011CfgInitialize(&pl011_obj, &config);
Pl011SetHandler(&pl011_obj, UartIrqCallback, NULL);
InterruptSetPriority(pl011_obj.config.irq_num, set_irq_priority);
InterruptInstall(pl011_obj.config.irq_num, UartIrqHandler, &pl011_obj, "uart1");
InterruptUmask(pl011_obj.config.irq_num);
Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN);
Pl011IrqEnableReciveTimeOut(&pl011_obj);
}
void TestUart()
{
char Byte;
UartInit();
while (1)
{
while (get_uart_rx_flg == 0)
{
}
Byte = Pl011BlockReceive(&pl011_obj);
printf("-->recv %c\r\n", Byte);
Pl011BlockSend(&pl011_obj, &Byte, 1);
InterruptMask(pl011_obj.config.irq_num);
set_irq_priority++;
InterruptSetPriority(pl011_obj.config.irq_num, set_irq_priority);
InterruptUmask(pl011_obj.config.irq_num);
get_uart_rx_flg = 0;
Pl011IrqEnableReciveTimeOut(&pl011_obj);
}
}

1
baremetal/example/libmetal_test/README.md

@ -106,6 +106,7 @@
tftpboot f1000000 libmetal_core1.elf /* 通过tftp通信,将例程中core1 elf 拷贝至内存中 */
bootelf -p f0000000 /* 加载core0 代码 */
```
```
setenv ipaddr 192.168.4.20
setenv serverip 192.168.4.50

13
baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig

@ -8,7 +8,6 @@
#
CONFIG_TARGET_NAME="libmetal_core0"
CONFIG_SHM_BASE_ADDR=0xc0000000
CONFIG_RPU_CORE_IPI_MASK=0x2
# end of Baremetal Configuration
#
@ -23,7 +22,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
# end of Project Configuration
#
# Board Setting
# Platform Setting
#
#
@ -33,7 +32,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
@ -70,14 +69,15 @@ CONFIG_ENABLE_Pl011_UART=y
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Board Setting
# end of Platform Setting
#
# Building Option
#
CONFIG_ENVI_LINUX_X86_64=y
#
# Cross-Compiler Setting
@ -115,6 +115,7 @@ CONFIG_STACK_SIZE=0x100000
# Library Configuration
#
CONFIG_USE_G_LIBC=y
# CONFIG_USE_NEW_LIBC is not set
# end of Library Configuration
#
@ -131,4 +132,6 @@ CONFIG_LS_PL011_UART=y
CONFIG_USE_AMP=y
CONFIG_USE_LIBMETAL=y
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

19
baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig

@ -8,7 +8,6 @@
#
CONFIG_TARGET_NAME="libmetal_core0"
CONFIG_SHM_BASE_ADDR=0xc0000000
CONFIG_RPU_CORE_IPI_MASK=0x2
# end of Baremetal Configuration
#
@ -23,7 +22,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
# end of Project Configuration
#
# Board Setting
# Platform Setting
#
#
@ -33,7 +32,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -69,14 +68,15 @@ CONFIG_ENABLE_Pl011_UART=y
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Board Setting
# end of Platform Setting
#
# Building Option
#
CONFIG_ENVI_LINUX_X86_64=y
#
# Cross-Compiler Setting
@ -85,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_VERBOS is not set
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
# CONFIG_LOG_ERROR is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_NONE is not set
#
@ -105,7 +105,7 @@ CONFIG_ROM_SIZE_MB=2
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0x80300000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x40000
CONFIG_HEAP_SIZE=0x400000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
@ -114,6 +114,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000
# Library Configuration
#
CONFIG_USE_G_LIBC=y
# CONFIG_USE_NEW_LIBC is not set
# end of Library Configuration
#
@ -130,4 +131,6 @@ CONFIG_LS_PL011_UART=y
CONFIG_USE_AMP=y
CONFIG_USE_LIBMETAL=y
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

26
baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig

@ -8,7 +8,6 @@
#
CONFIG_TARGET_NAME="libmetal_core1"
CONFIG_SHM_BASE_ADDR=0xc0000000
CONFIG_APU_CORE_IPI_MASK=0x1
# end of Baremetal Configuration
#
@ -22,7 +21,7 @@ CONFIG_TARGET_CPU_ID=1
# end of Project Configuration
#
# Board Setting
# Platform Setting
#
#
@ -32,7 +31,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# CONFIG_USE_AARCH64_L1_TO_AARCH32 is not set
@ -53,7 +52,14 @@ CONFIG_TARGET_D2000=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -62,19 +68,20 @@ CONFIG_EBABLE_GICV3=y
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Board Setting
# end of Platform Setting
#
# Building Option
#
CONFIG_ENVI_LINUX_X86_64=y
#
# Cross-Compiler Setting
#
# CONFIG_COMPILER_NO_STD_STARUP is not set
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
@ -98,7 +105,7 @@ CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0xa0200000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x1000
CONFIG_HEAP_SIZE=0x40000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option
@ -107,6 +114,7 @@ CONFIG_STACK_SIZE=0x1000
# Library Configuration
#
CONFIG_USE_G_LIBC=y
# CONFIG_USE_NEW_LIBC is not set
# end of Library Configuration
#
@ -116,4 +124,6 @@ CONFIG_USE_G_LIBC=y
# CONFIG_USE_LETTER_SHELL is not set
CONFIG_USE_AMP=y
CONFIG_USE_LIBMETAL=y
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

52
baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig

@ -6,23 +6,23 @@
#
# Baremetal Configuration
#
CONFIG_TARGET_NAME="libmetal_core1"
CONFIG_TARGET_NAME="libmetal_core0"
CONFIG_SHM_BASE_ADDR=0xc0000000
CONFIG_APU_CORE_IPI_MASK=0x1
# end of Baremetal Configuration
#
# AMP Config
# Amp Config
#
CONFIG_IPI_IRQ_NUM=0
CONFIG_IPI_IRQ_NUM_PRIORITY=16
CONFIG_SPIN_MEM=0x80000000
CONFIG_TARGET_CPU_ID=1
# end of AMP Config
CONFIG_TARGET_CPU_ID=2
CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
# end of Amp Config
# end of Project Configuration
#
# Board Setting
# Platform Setting
#
#
@ -32,7 +32,7 @@ CONFIG_TARGET_CPU_ID=1
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -52,7 +52,14 @@ CONFIG_TARGET_D2000=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -61,19 +68,20 @@ CONFIG_EBABLE_GICV3=y
# CONFIG_USE_TIMER is not set
# CONFIG_USE_SDMMC is not set
# CONFIG_USE_PCIE is not set
# CONFIG_USE_WDT is not set
# CONFIG_USE_DMA is not set
# CONFIG_USE_NAND is not set
# end of Components Configuration
# end of Board Setting
# end of Platform Setting
#
# Building Option
#
CONFIG_ENVI_LINUX_X86_64=y
#
# Cross-Compiler Setting
#
# CONFIG_COMPILER_NO_STD_STARUP is not set
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
@ -92,13 +100,13 @@ CONFIG_AARCH64_RAM_LD=y
# CONFIG_QEMU_AARCH32_RAM_LD is not set
# CONFIG_USER_DEFINED_LD is not set
CONFIG_LINK_SCRIPT_ROM=y
CONFIG_ROM_START_UP_ADDR=0xa0100000
CONFIG_ROM_SIZE_MB=1
CONFIG_ROM_START_UP_ADDR=0x80100000
CONFIG_ROM_SIZE_MB=2
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0xa0200000
CONFIG_RAM_START_UP_ADDR=0x80300000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x40000
CONFIG_STACK_TOP_ADDR=0xa2000000
CONFIG_HEAP_SIZE=0x400000
CONFIG_STACK_TOP_ADDR=0x82000000
# end of Linker Options
# end of Building Option
@ -106,13 +114,23 @@ CONFIG_STACK_TOP_ADDR=0xa2000000
# Library Configuration
#
CONFIG_USE_G_LIBC=y
# CONFIG_USE_NEW_LIBC is not set
# end of Library Configuration
#
# Third-Party Configuration
#
# CONFIG_USE_LWIP is not set
# CONFIG_USE_LETTER_SHELL is not set
CONFIG_USE_LETTER_SHELL=y
#
# Letter Shell Configuration
#
CONFIG_LS_PL011_UART=y
# end of Letter Shell Configuration
CONFIG_USE_AMP=y
CONFIG_USE_LIBMETAL=y
# CONFIG_USE_YAFFS2 is not set
# CONFIG_USE_SDMMC_CMD is not set
# end of Third-Party Configuration

6
baremetal/example/libmetal_test/core0/configs/d2000_aarch32_eg_configs

@ -32,7 +32,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
@ -86,11 +86,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

6
baremetal/example/libmetal_test/core0/configs/d2000_aarch64_eg_configs

@ -32,7 +32,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -85,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

6
baremetal/example/libmetal_test/core0/configs/ft2004_aarch32_eg_configs

@ -32,7 +32,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
@ -86,11 +86,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

6
baremetal/example/libmetal_test/core0/configs/ft2004_aarch64_eg_configs

@ -32,7 +32,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -85,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

7
baremetal/example/libmetal_test/core0/main.c

@ -4,7 +4,7 @@
*  SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-08-31 09:56:32
* @LastEditTime: 2021-09-07 09:10:38
* @LastEditTime: 2021-10-29 09:42:45
* @Description:  Description of file
* @Modify History:
* * * Ver   Who        Date         Changes
@ -40,11 +40,14 @@ static int LibmetalApu(int argc, char *argv[])
SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), LibmetalApu, LibmetalApu, LibmetalApu);
int main(void)
{
s32 ret ;
ret = SysInit() ;
if(ret)
if (ret)
{
LIBMETAL_MAIN_DEBUG_E("Failed to initialize system.\n");
return ret;

8
baremetal/example/libmetal_test/core0/makefile

@ -1,15 +1,15 @@
export PROJECT_DIR ?= .
export PROJECT_DIR ?= $(shell pwd)
export USR_SRC_DIR = . \
export USR_SRC_DIR = $(PROJECT_DIR) \
$(PROJECT_DIR)/../common
export USR_INC_DIR = . \
export USR_INC_DIR = $(PROJECT_DIR) \
$(PROJECT_DIR)/../common
# 用户定义的编译目标文件上传路径
ifeq ($(OS),Windows_NT)
USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp
else
USR_BOOT_DIR ?= /mnt/d/phytium-dev/tftp
USR_BOOT_DIR ?= /mnt/d/tftboot
endif
# 设置启动镜像名

6
baremetal/example/libmetal_test/core0/sdkconfig

@ -32,7 +32,7 @@ CONFIG_TARGET_CPU_FUNCATION_ADDR=0xa0100000
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -85,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

6
baremetal/example/libmetal_test/core0/sdkconfig.h

@ -27,7 +27,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */
@ -72,11 +72,11 @@
#define CONFIG_COMPILER_NO_STD_STARUP
/* CONFIG_USE_EXT_COMPILER is not set */
/* end of Cross-Compiler Setting */
/* CONFIG_LOG_VERBOS is not set */
#define CONFIG_LOG_VERBOS
/* CONFIG_LOG_DEBUG is not set */
/* CONFIG_LOG_INFO is not set */
/* CONFIG_LOG_WARN is not set */
#define CONFIG_LOG_ERROR
/* CONFIG_LOG_ERROR is not set */
/* CONFIG_LOG_NONE is not set */
/* Linker Options */

19
baremetal/example/libmetal_test/core1/configs/d2000_aarch32_eg_configs

@ -31,10 +31,10 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
# CONFIG_USE_AARCH64_L1_TO_AARCH32 is not set
# end of Arch Configuration
#
@ -52,7 +52,14 @@ CONFIG_TARGET_D2000=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -78,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
@ -98,7 +105,7 @@ CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0xa0200000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x1000
CONFIG_HEAP_SIZE=0x40000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option

17
baremetal/example/libmetal_test/core1/configs/d2000_aarch64_eg_configs

@ -31,7 +31,7 @@ CONFIG_TARGET_CPU_ID=1
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -51,7 +51,14 @@ CONFIG_TARGET_D2000=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -73,15 +80,15 @@ CONFIG_EBABLE_GICV3=y
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_COMPILER_NO_STD_STARUP is not set
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

19
baremetal/example/libmetal_test/core1/configs/ft2004_aarch32_eg_configs

@ -31,10 +31,10 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
# CONFIG_USE_AARCH64_L1_TO_AARCH32 is not set
# end of Arch Configuration
#
@ -52,7 +52,14 @@ CONFIG_TARGET_F2000_4=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -78,11 +85,11 @@ CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#
@ -98,7 +105,7 @@ CONFIG_ROM_SIZE_MB=1
CONFIG_LINK_SCRIPT_RAM=y
CONFIG_RAM_START_UP_ADDR=0xa0200000
CONFIG_RAM_SIZE_MB=64
CONFIG_HEAP_SIZE=0x1000
CONFIG_HEAP_SIZE=0x40000
CONFIG_STACK_SIZE=0x1000
# end of Linker Options
# end of Building Option

17
baremetal/example/libmetal_test/core1/configs/ft2004_aarch64_eg_configs

@ -31,7 +31,7 @@ CONFIG_TARGET_CPU_ID=1
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -51,7 +51,14 @@ CONFIG_TARGET_F2000_4=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -73,15 +80,15 @@ CONFIG_EBABLE_GICV3=y
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_COMPILER_NO_STD_STARUP is not set
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

8
baremetal/example/libmetal_test/core1/makefile

@ -1,15 +1,15 @@
export PROJECT_DIR ?= .
export PROJECT_DIR ?= $(shell pwd)
export USR_SRC_DIR = . \
export USR_SRC_DIR = $(PROJECT_DIR) \
$(PROJECT_DIR)/../common
export USR_INC_DIR = . \
export USR_INC_DIR = $(PROJECT_DIR) \
$(PROJECT_DIR)/../common
# 用户定义的编译目标文件上传路径
ifeq ($(OS),Windows_NT)
USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp
else
USR_BOOT_DIR ?= /mnt/d/phytium-dev/tftp
USR_BOOT_DIR ?= /mnt/d/tftboot
endif
# 设置启动镜像名

17
baremetal/example/libmetal_test/core1/sdkconfig

@ -31,7 +31,7 @@ CONFIG_TARGET_CPU_ID=1
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration
@ -51,7 +51,14 @@ CONFIG_TARGET_D2000=y
# CONFIG_USE_QSPI is not set
CONFIG_USE_GIC=y
CONFIG_EBABLE_GICV3=y
# CONFIG_USE_SERIAL is not set
CONFIG_USE_SERIAL=y
#
# Usart Configuration
#
CONFIG_ENABLE_Pl011_UART=y
# end of Usart Configuration
# CONFIG_USE_GPIO is not set
# CONFIG_USE_IOMUX is not set
# CONFIG_USE_ETH is not set
@ -73,15 +80,15 @@ CONFIG_EBABLE_GICV3=y
#
# Cross-Compiler Setting
#
CONFIG_COMPILER_NO_STD_STARUP=y
# CONFIG_COMPILER_NO_STD_STARUP is not set
# CONFIG_USE_EXT_COMPILER is not set
# end of Cross-Compiler Setting
# CONFIG_LOG_VERBOS is not set
CONFIG_LOG_VERBOS=y
# CONFIG_LOG_DEBUG is not set
# CONFIG_LOG_INFO is not set
# CONFIG_LOG_WARN is not set
CONFIG_LOG_ERROR=y
# CONFIG_LOG_ERROR is not set
# CONFIG_LOG_NONE is not set
#

15
baremetal/example/libmetal_test/core1/sdkconfig.h

@ -26,7 +26,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */
@ -44,7 +44,12 @@
/* CONFIG_USE_QSPI is not set */
#define CONFIG_USE_GIC
#define CONFIG_EBABLE_GICV3
/* CONFIG_USE_SERIAL is not set */
#define CONFIG_USE_SERIAL
/* Usart Configuration */
#define CONFIG_ENABLE_Pl011_UART
/* end of Usart Configuration */
/* CONFIG_USE_GPIO is not set */
/* CONFIG_USE_IOMUX is not set */
/* CONFIG_USE_ETH is not set */
@ -63,14 +68,14 @@
/* Cross-Compiler Setting */
#define CONFIG_COMPILER_NO_STD_STARUP
/* CONFIG_COMPILER_NO_STD_STARUP is not set */
/* CONFIG_USE_EXT_COMPILER is not set */
/* end of Cross-Compiler Setting */
/* CONFIG_LOG_VERBOS is not set */
#define CONFIG_LOG_VERBOS
/* CONFIG_LOG_DEBUG is not set */
/* CONFIG_LOG_INFO is not set */
/* CONFIG_LOG_WARN is not set */
#define CONFIG_LOG_ERROR
/* CONFIG_LOG_ERROR is not set */
/* CONFIG_LOG_NONE is not set */
/* Linker Options */

2
baremetal/example/lwip_test/configs/d2000_aarch32_eg_configs

@ -18,7 +18,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/lwip_test/configs/d2000_aarch64_eg_configs

@ -18,7 +18,7 @@ CONFIG_LWIP_POLL_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
# end of Arch Configuration

2
baremetal/example/lwip_test/configs/ft2004_aarch32_eg_configs

@ -18,7 +18,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/lwip_test/configs/ft2004_aarch64_eg_configs

@ -18,7 +18,7 @@ CONFIG_LWIP_POLL_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
# end of Arch Configuration

2
baremetal/example/lwip_test/sdkconfig

@ -18,7 +18,7 @@ CONFIG_LWIP_POLL_TEST=y
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
CONFIG_USE_SYS_TICK=y
# end of Arch Configuration

2
baremetal/example/lwip_test/sdkconfig.h

@ -16,7 +16,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
#define CONFIG_USE_SYS_TICK
/* end of Arch Configuration */

2
baremetal/example/nand_flash_test/configs/e2000_aarch32_eg_configs

@ -21,7 +21,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/nand_flash_test/configs/e2000_aarch64_eg_configs

@ -21,7 +21,7 @@ CONFIG_TARGET_NAME="e2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/nand_flash_test/sdkconfig

@ -21,7 +21,7 @@ CONFIG_TARGET_NAME="e2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/nand_flash_test/sdkconfig.h

@ -17,7 +17,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

2
baremetal/example/newlibc_test/configs/d2000_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/newlibc_test/configs/d2000_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="d2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/newlibc_test/configs/e2000_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/newlibc_test/configs/e2000_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="e2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/newlibc_test/configs/ft2004_aarch32_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_ARMV8_AARCH32=y
# CONFIG_TARGET_ARMV8_AARCH64 is not set
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y

2
baremetal/example/newlibc_test/configs/ft2004_aarch64_eg_configs

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="ft2004_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/newlibc_test/sdkconfig

@ -16,7 +16,7 @@ CONFIG_TARGET_NAME="e2000_baremetal_a64"
CONFIG_TARGET_ARMV8_AARCH64=y
# CONFIG_TARGET_ARMV7 is not set
CONFIG_USE_CACHE=y
CONFIG_USE_L3CACHE=y
# CONFIG_USE_L3CACHE is not set
CONFIG_USE_MMU=y
# CONFIG_USE_SYS_TICK is not set
# end of Arch Configuration

2
baremetal/example/newlibc_test/sdkconfig.h

@ -14,7 +14,7 @@
#define CONFIG_TARGET_ARMV8_AARCH64
/* CONFIG_TARGET_ARMV7 is not set */
#define CONFIG_USE_CACHE
#define CONFIG_USE_L3CACHE
/* CONFIG_USE_L3CACHE is not set */
#define CONFIG_USE_MMU
/* CONFIG_USE_SYS_TICK is not set */
/* end of Arch Configuration */

398
baremetal/example/overall_test/cmd_sdio_poll/cmd_verify.c

@ -0,0 +1,398 @@
/*
* @ : Copyright (c) 2021 Phytium Information Technology, Inc.
*
* SPDX-License-Identifier: Apache-2.0.
*
* @Date: 2021-09-27 13:38:29
* @LastEditTime: 2021-10-19 19:37:07
* @Description:  This files is for
*
* @Modify History:
* Ver   Who        Date         Changes
* ----- ------     --------    --------------------------------------
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "strto.h"
#include "fsleep.h"
#include "sdkconfig.h"
#ifndef SDK_CONFIG_H__
#warning "Please include sdkconfig.h"
#endif
#include "ft_debug.h"
#include "cache.h"
#include "parameters.h"
#include "../src/shell.h"
#include "../port/shell_port.h"
#include "parameters.h"
#include "f_sdio.h"
#include "f_sdio_hw.h"
static u32 base_addr = FSDIO_HOST_0_BASE_ADDR;
#define FSDIO_OUT32(reg_off, reg_val) FtOut32(base_addr + (u32)(reg_off), (u32)(reg_val))
#define FSDIO_IN32(reg_off) FtIn32(base_addr + (u32)(reg_off))
static void SdioSendPrivateCmd(u32 cmd, u32 arg)
{
FSDIO_OUT32(FSDIO_REG_CMDARG_OFFSET, arg);
int retries = 0;
do
{
if ((0 == retries % 100) && (0 != retries))
printf("card busy\r\n");
fsleep_microsec(1);
} while ((FSDIO_STATUS_CARD_BUSY & FSDIO_IN32(FSDIO_REG_STATUS_OFFSET)) &&
(FSDIO_TIMEOUT > ++retries));
if (FSDIO_TIMEOUT <= retries)
{
printf("wait card busy timeout\r\n");
}
FSDIO_OUT32(FSDIO_REG_CMD_OFFSET, cmd | FSDIO_CMD_START);
retries = 0;
do
{
if ((0 == retries % 100) && (0 != retries))
printf("cmd sending\r\n");
fsleep_microsec(1);
} while ((FSDIO_IN32(FSDIO_CMD_START & FSDIO_REG_CMD_OFFSET)) &&
(FSDIO_TIMEOUT > ++retries));
if (FSDIO_TIMEOUT <= retries)
{
printf("wait cmd sending timeout\r\n");
}
}
static void SdioWaitCmd()
{
u32 raw_stats, dma_status;
int retries = 0;
//wait cmd
while(1)
{
raw_stats = FSDIO_IN32(FSDIO_REG_RAW_INTS_OFFSET);
//dma_status = FSDIO_IN32(FSDIO_REG_DMAC_STATUS_OFFSET);
if (FSDIO_INT_CMD_BIT & raw_stats)
{
printf("cmd success\r\n");
break;
}
else if (raw_stats)
{
printf("cmd exit 0x%x\r\n", raw_stats);
break;
}
FSDIO_OUT32(FSDIO_REG_RAW_INTS_OFFSET, 0xffffffff);
if (1000 < ++retries)
{
break;
}
if ((0 == retries % 100) && (0 != retries))
printf("status: 0x%x \r\n", FSDIO_IN32(FSDIO_REG_STATUS_OFFSET));
}
}
static void SdioSendCmd(u32 cmd, u32 arg, u32 opcode, const char *cmd_str)
{
printf("====cmd %d [%s] start=======\r\n", opcode, cmd_str);
if (FSDIO_CARD_DETECTED == (FSDIO_CARD_DETECTED & FSDIO_IN32(FSDIO_REG_CARD_DETECT_OFFSET)))
{
printf("card not exists\r\n");
return;
}
SdioSendPrivateCmd(cmd, arg);
SdioWaitCmd();
printf("====cmd %d done=======\r\n", opcode);
}
static void SdioWaitDat()
{
u32 status, raw_ints, dma_status;
int retries = 0;
printf("====wait data start===\r\n");
while (1)
{
status = FSDIO_IN32(FSDIO_REG_STATUS_OFFSET);
raw_ints = FSDIO_IN32(FSDIO_REG_RAW_INTS_OFFSET);
dma_status = FSDIO_IN32(FSDIO_REG_DMAC_STATUS_OFFSET);
if (raw_ints & FSDIO_INT_DTO_BIT)
{
printf("data transfer success 0x%x 0x%x\r\n", raw_ints, dma_status);
if (FSDIO_DMAC_STATUS_TI & dma_status)
{
printf("send data done \r\n");
}
if (FSDIO_DMAC_STATUS_RI & dma_status)
{
printf("recv data done \r\n");
}
break;
}
else if (raw_ints)
{
/*
0x1114 bit 12, 8, 4, 2 HLE, Response timeout, Transmit FIFO data request, Command done
*/
printf("data transfer exit with status: 0x%x raw_ints: 0x%x dma_status: 0X%x\r\n",
status, raw_ints, dma_status);
break;
}
FSDIO_OUT32(FSDIO_REG_RAW_INTS_OFFSET, 0xffffffff);
if (1000 < ++retries)
{
break;
}
/*
WRITE:
status: 0x80001906 bit 31 12 11 8 3 2: DMA ACK, FIFO COUNT, DAT[3] FIFO FULL FIFO EMPTY
raw_ints: 0x114 bit 8 4 2: RESP TIMEOUT, TX FIFO, COMMAND DONE
dma: 0x2000 bit 13: SUSPEND
READ:
status: 0x1906 bit 12 11 8 3 2
raw_ints: 0x114
dma: 0x2000
*/
/*
WRITE
status: 0x8001f906 bit 31 16 15 14 13 12 11 8 3 2:
ints: 0x1114 bit 12 8 4 2 HLE
dma: 0x2000
*/
if ((0 == retries % 100) && (0 != retries))
printf("status: 0x%x, ints: 0x%x dma: 0x%x\r\n", status, raw_ints, dma_status);
}
printf("====wait data end===\r\n");
}
static int SdioVerifyEntry(int argc, char *argv[])
{
int i;
printf("====init=======\r\n");
FSDIO_OUT32(FSDIO_REG_FIFOTH_OFFSET, 0x20070008);
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x0);
FSDIO_OUT32((FSDIO_REG_UHS_REG_EXT_OFFSET), 0x0502);
FSDIO_OUT32((FSDIO_REG_UHS_REG_OFFSET), 0x0); //设置电压为3.3v
FSDIO_OUT32((FSDIO_REG_PWREN_OFFSET), 0x1); //打开供电开关
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x1);
/* reset dma and fifo */
FSDIO_OUT32(FSDIO_REG_CNTRL_OFFSET, FSDIO_CNTRL_FIFO_RESET | FSDIO_CNTRL_DMA_RESET | FSDIO_CNTRL_CONTROLLER_RESET);
do
{
printf("wait fifo and dma reset done\r\n");
} while ((FSDIO_CNTRL_FIFO_RESET | FSDIO_CNTRL_DMA_RESET | FSDIO_CNTRL_CONTROLLER_RESET) & FSDIO_IN32(FSDIO_REG_CNTRL_OFFSET));
FSDIO_OUT32((FSDIO_REG_BUS_MODE_OFFSET), 0x80); //bit[7] 使能idma
/* this lead to cmd timeout */
//FSDIO_OUT32((FSDIO_REG_CNTRL_OFFSET), FSDIO_CNTRL_INT_ENABLE | FSDIO_CNTRL_USE_INTERNAL_DMAC);//bit[23,4] card voltage, enable int
FSDIO_OUT32((FSDIO_REG_TMOUT_OFFSET), 0xffffffff); //set timeout
/* reset card */
FSDIO_OUT32(FSDIO_REG_CARD_RESET_OFFSET, FSDIO_CARD_RESET_ENABLE);
/* clr intr */
FSDIO_OUT32(FSDIO_REG_INT_MASK_OFFSET, 0);
FSDIO_OUT32(FSDIO_REG_RAW_INTS_OFFSET, FSDIO_IN32(FSDIO_REG_RAW_INTS_OFFSET));
FSDIO_OUT32(FSDIO_REG_DMAC_INT_ENA_OFFSET, 0);
FSDIO_OUT32(FSDIO_REG_DMAC_STATUS_OFFSET, FSDIO_IN32(FSDIO_REG_DMAC_STATUS_OFFSET));
/* update clk reg */
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x0);
FSDIO_OUT32((FSDIO_REG_CLKDIV_OFFSET), 0x7e7dfa);
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x1);
SdioSendPrivateCmd(0x80200000, 0);
SdioSendCmd(0xa0008000, 0x0, 0, "MMC_GO_IDLE_STATE");
SdioSendCmd(0xa0000148, 0x000001aa, 8, "SD_SEND_IF_COND");
u32 OCR_BUSY = 0x80000000;
for (i = 0; i < 100; i++)
{
SdioSendCmd(0xa0000177, 0x0, 55, "MMC_APP_CMD");
SdioSendCmd(0xa0000069, 0x41ff8000, 41, "SD_APP_OP_COND");
if (OCR_BUSY & FSDIO_IN32(FSDIO_REG_RESP0_OFFSET))
{
printf("CMD 8 success \r\n");
break;
}
}
SdioSendCmd(0xb000014b, 0x0, 11, "Voltage Switch");
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x0);
FSDIO_OUT32(FSDIO_REG_UHS_REG_EXT_OFFSET, 0x0);
FSDIO_OUT32(FSDIO_REG_UHS_REG_OFFSET, 0x1);
FSDIO_OUT32(FSDIO_REG_UHS_REG_EXT_OFFSET, 0x00000502);
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x1);
SdioSendPrivateCmd(0x80200000, 0);
SdioSendCmd(0xa00001c2, 0x0, 2, "MMC_ALL_SEND_CID");
SdioSendCmd(0xa0000143, 0x0, 3, "SD_SEND_RELATIVE_ADDR");
u32 reg_val = FSDIO_IN32(FSDIO_REG_RESP0_OFFSET);
u32 t = ((GENMASK(20, 4) &reg_val) >> 4);
printf("t: 0x%x\r\n", t); /* 0x1a0 */
/* 缺cmd9 */
SdioSendCmd(0xa0000147, t, 7, "MMC_SELECT_CARD");
//sd初始化完成
//设置时钟25M
/*
printf("====update clk (25M)=======\r\n");
FSDIO_OUT32((FSDIO_REG_UHS_REG_EXT_OFFSET), 0x0);
FSDIO_OUT32((FSDIO_REG_UHS_REG_EXT_OFFSET), 0x202);
printf("CCLK_READY: 0x%x\r\n", FSDIO_IN32((FSDIO_REG_CCLK_READY_OFFSET)));
//read bit[1] ==1
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x0);
printf("use clkdiv=0x080710\r\n");
FSDIO_OUT32((FSDIO_REG_CLKDIV_OFFSET), 0x080710);
FSDIO_OUT32((FSDIO_REG_CLKENA_OFFSET), 0x1);
SdioSendPrivateCmd(0x80200000, 0);
fsleep_microsec(1);
printf("CMD: 0x%x\r\n", FSDIO_IN32((FSDIO_REG_CMD_OFFSET)));
printf("====update clk done =======\r\n"); */
fsleep_microsec(2);
//设置4线宽模式:
SdioSendCmd(0xa0000177, t, 55, "MMC_APP_CMD");
FSDIO_OUT32(FSDIO_REG_CTYPE_OFFSET, 1);
SdioSendCmd(0xa0000146, 0x00000002, 6, "MMC_SWITCH");
printf("set 4 width\r\n");
SdioSendCmd(0xa0000150, 0x00000200, 16, "MMC_SET_BLOCKLEN");
printf("set block length\r\n");
//设置描述符表,写,首地址:0x234fb02000
//FtOut32(0x234fb00000 0x8000002c
FtOut32(0x234fb00000, 0x8000000c);
FtOut32(0x234fb00004, 0x0);
FtOut32(0x234fb00008, 0x200);
FtOut32(0x234fb0000c, 0x0);
FtOut32(0x234fb00010, 0x4fb02000);
FtOut32(0x234fb00014, 0x23);
FtOut32(0x234fb00018, 0x0);
FtOut32(0x234fb0001c, 0x0);
//写数据物理地址:234f002000 及地址+8K偏移:
FtOut32(0x234fb02000, 0x55555555);
FtOut32(0x234fb02004, 0xaaaaaaaa);
FtOut32(0x234fb02008, 0xaaaaaaaa);
FtOut32(0x234fb0200c, 0xaaaaaaaa);
FtOut32(0x234fb02010, 0xaaaaaaaa);
FtOut32(0x234fb02014, 0xaaaaaaaa);
FtOut32(0x234fb02018, 0xaaaaaaaa);
FtOut32(0x234fb0201c, 0xaaaaaaaa);
FtOut32(0x234fb02020, 0xaaaaaaaa);
FtOut32(0x234fb02024, 0xaaaaaaaa);
FtOut32(0x234fb02028, 0xaaaaaaaa);
FtOut32(0x234fb0202c, 0xaaaaaaaa);
FtOut32(0x234fb02030, 0xaaaaaaaa);
FtOut32(0x234fb02034, 0xaaaaaaaa);
FtOut32(0x234fb02038, 0xaaaaaaaa);
FtOut32(0x234fb0203c, 0xaaaaaaaa);
FtOut32(0x234fb02040, 0xaaaaaaaa);
FtOut32(0x234fb02044, 0xaaaaaaaa);
FtOut32(0x234fb02048, 0xaaaaaaaa);
FtOut32(0x234fb0204c, 0xaaaaaaaa);
FtOut32(0x234fb02050, 0xaaaaaaaa);
FtOut32(0x234fb02054, 0xaaaaaaaa);
FtOut32(0x234fb02058, 0xaaaaaaaa);
FtOut32(0x234fb0205c, 0xaaaaaaaa);
FtOut32(0x234fb02060, 0xaaaaaaaa);
FtOut32(0x234fb02064, 0xaaaaaaaa);
FtOut32(0x234fb02068, 0x55555555);
/* invalidate cache for write buffer */
FCacheDCacheInvalidateRange(0x234fb02000, 0x200);
//10)设置写描述符地址:
FSDIO_OUT32((FSDIO_REG_DESC_LIST_ADDRL_OFFSET), 0x4fb00000);
FSDIO_OUT32((FSDIO_REG_DESC_LIST_ADDRH_OFFSET), 0x23);
FSDIO_OUT32(FSDIO_REG_BLKSIZ_OFFSET, 0x200);
FSDIO_OUT32(FSDIO_REG_BYTCNT_OFFSET, 0x200);
SdioSendCmd(0xa0000758, 0, 24, "MMC_WRITE_BLOCK_SINGLE");
SdioWaitDat();
//设置读描述符表:描述符表基地址addr:234f000000
//FtOut32(0x234fb00000 0x8000002c
FtOut32(0x234fb00000,0x8000000c);
FtOut32(0x234fb00004,0x0);
FtOut32(0x234fb00008,0x200);
FtOut32(0x234fb0000c,0x0);
FtOut32(0x234fb00010,0x4fb01000);
FtOut32(0x234fb00014,0x23);
FtOut32(0x234fb00018,0x0);
FtOut32(0x234fb0001c,0x0);
//10)设置读描述符地址:
FSDIO_OUT32((FSDIO_REG_DESC_LIST_ADDRL_OFFSET), 0x4fb00000);
FSDIO_OUT32((FSDIO_REG_DESC_LIST_ADDRH_OFFSET), 0x23);
FSDIO_OUT32(FSDIO_REG_BLKSIZ_OFFSET, 0x200);
FSDIO_OUT32((FSDIO_REG_BYTCNT_OFFSET), 0x200);
FtOut32(0x234fb01000,0);
FtOut32(0x234fb01004,0);
FtOut32(0x234fb01008,0);
FtOut32(0x234fb0100c,0);
FtOut32(0x234fb01010,0);
FtOut32(0x234fb01014,0);
FtOut32(0x234fb01018,0);
FtOut32(0x234fb0101c,0);
FtOut32(0x234fb01020,0);
FtOut32(0x234fb01024,0);
FtOut32(0x234fb01028,0);
FtOut32(0x234fb0102c,0);
FtOut32(0x234fb01030,0);
FtOut32(0x234fb01034,0);
FtOut32(0x234fb01038,0);
FtOut32(0x234fb0103c,0);
FtOut32(0x234fb01040,0);
FtOut32(0x234fb01044,0);
FtOut32(0x234fb01048,0);
SdioSendCmd(0xa0000351, 0x0, 17, "MMC_READ_BLOCK_SINGLE");
SdioWaitDat();
FCacheDCacheInvalidateRange(0x234fb01000, 0x200);
FtDumpHexByte((u8 *)(void *)0x234fb01000, 30);
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), sdio_verify, SdioVerifyEntry, test sdio register);

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save