add files for pico

This commit is contained in:
Lyon 2023-04-23 18:25:59 +08:00
parent 5b838a7da6
commit 7e7e3e661e
12 changed files with 1688 additions and 1 deletions

View File

@ -0,0 +1,7 @@
#
# DIR_Config_SRCS
aux_source_directory(. DIR_Config_SRCS)
#
add_library(Config ${DIR_Config_SRCS})
target_link_libraries(Config PUBLIC pico_stdlib hardware_spi hardware_i2c hardware_pwm hardware_adc)

View File

@ -0,0 +1,6 @@
#
# DIR_Fonts_SRCS
aux_source_directory(. DIR_Fonts_SRCS)
#
add_library(Fonts ${DIR_Fonts_SRCS})

View File

@ -0,0 +1,9 @@
#
# DIR_GUI_SRCS
aux_source_directory(. DIR_GUI_SRCS)
include_directories(../Config)
#
add_library(GUI ${DIR_GUI_SRCS})
target_link_libraries(GUI PUBLIC Config)

View File

@ -0,0 +1,9 @@
#
# DIR_ePaper_SRCS
aux_source_directory(. DIR_LCD_SRCS)
include_directories(../Config)
#
add_library(LCD ${DIR_LCD_SRCS})
target_link_libraries(LCD PUBLIC Config)

View File

@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 3.13)
# Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK itself. For all other uses
# it is included as a subdirectory via the pico_sdk_init() method provided by pico_sdk_init.cmake
if (NOT TARGET _pico_sdk_inclusion_marker)
add_library(_pico_sdk_inclusion_marker INTERFACE)
# This is a no-op unless we are the top-level CMakeLists.txt
include(pico_sdk_init.cmake)
project(pico_sdk C CXX ASM)
message("Build type is ${CMAKE_BUILD_TYPE}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if (PICO_DEOPTIMIZED_DEBUG)
message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
else()
message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)")
endif()
endif()
pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
set(PICO_SDK 1 PARENT_SCOPE)
endif()
# allow customization
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
add_subdirectory(tools)
add_subdirectory(src)
# allow customization
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
add_sub_list_files(PICO_SDK_POST_LIST_FILES)
if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
set(PICO_SDK_TESTS_ENABLED 1)
endif()
if (PICO_SDK_TESTS_ENABLED)
add_subdirectory(test)
endif ()
set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
# add docs at the end, as we gather documentation dirs as we go
add_subdirectory(docs)
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
pico_promote_common_scope_vars()
endif()
endif()

View File

@ -1,2 +1,2 @@
pikascript-core==v1.12.1
PikaStdLib==v1.12.1
PikaStdLib==v1.12.1

View File

@ -0,0 +1,73 @@
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc
; command above MUST be in first line (no comment above!)
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
#define FLASH_SIZE 0x00200000
#define SRAM_SIZE (1024*248)
#define STACK_0_SIZE (1024*4)
#define STACK_1_SIZE (1024*1)
#define HEAP_0_SIZE (1024*32)
#define HEAP_1_SIZE (1024*1)
#define RAMSIZE_VALID (SRAM_SIZE - \
STACK_1_SIZE - HEAP_1_SIZE - \
STACK_0_SIZE - HEAP_0_SIZE - 0x100)
LR_STAGE2_BOOT 0x10000000 0x100 {
ER_STAGE2_BOOT +0 0x100 {
compile_time_choice.o (+RO)
}
ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) {
}
}
LR_IROM1 0x10000100 FLASH_SIZE - ImageLength(LR_STAGE2_BOOT) { ; load region size_region
ER_FLASH +0 0x00200000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
* (+RO-DATA)
startup_RP2040.o (+RO)
* (+RO-CODE)
* (+XO)
}
ER_RAM_VECTOR_TABLE 0x20000000 {
* (.ram_vector_table)
}
ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE {
}
ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE {
}
ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE {
}
ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE {
}
ER_MUTEX_ARRAY +0 {
* (.mutex_array.*)
* (.mutex_array)
}
;ER_PREINIT_ARRAY +0 {
; * (.preinit_array.*)
; * (.preinit_array)
;}
RW_IRAM +0 RAMSIZE_VALID { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM_NOINIT +0 UNINIT { ; RW data
.ANY (.bss.noinit)
}
}

View File

@ -0,0 +1,85 @@
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc
; command above MUST be in first line (no comment above!)
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
#define FLASH_SIZE 0x00200000
#define SRAM_SIZE (1024*248)
#define STACK_0_SIZE (1024*4)
#define STACK_1_SIZE (1024*1)
#define HEAP_0_SIZE (1024*32)
#define HEAP_1_SIZE (1024*1)
#define RAMSIZE_VALID (SRAM_SIZE - \
STACK_1_SIZE - HEAP_1_SIZE - \
STACK_0_SIZE - HEAP_0_SIZE - 0x100)
;LR_STAGE2_BOOT 0x10000000 0x100 {
; ER_STAGE2_BOOT +0 0x100 {
; compile_time_choice.o (+RO)
; }
; ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) {
; }
;}
LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region
ER_BINRAY_INFO +0 {
* (:gdef:Reset_Handler) //!< please always make sure that Reset_Handler is placed here.
* (.binary_info_header)
}
;ER_RAM_VECTOR_TABLE +0 ALIGN 256 {
; * (.ram_vector_table)
;}
ER_FLASH +0 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
* (+RO-DATA)
startup_RP2040.o (+RO)
}
ER_MUTEX_ARRAY +0 {
* (.mutex_array.*)
* (.mutex_array)
}
RW_IRAM_CODE +0 {
* (+RO-CODE)
* (+XO)
}
ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE {
}
ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE {
}
ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE {
}
ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE {
}
;ER_PREINIT_ARRAY +0 {
; * (.preinit_array.*)
; * (.preinit_array)
;}
RW_IRAM +0 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM_UNINIT +0 UNINIT {
.ANY (.bss.noinit)
}
}

View File

@ -0,0 +1,72 @@
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc
; command above MUST be in first line (no comment above!)
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
#define FLASH_SIZE 0x00200000
#define SRAM_SIZE (1024*248)
#define STACK_0_SIZE (1024*4)
#define STACK_1_SIZE (1024*1)
#define HEAP_0_SIZE (1024*32)
#define HEAP_1_SIZE (1024*1)
#define RAMSIZE_VALID (SRAM_SIZE - \
STACK_1_SIZE - HEAP_1_SIZE - \
STACK_0_SIZE - HEAP_0_SIZE - 0x100)
LR_STAGE2_BOOT 0x10000000 0x100 {
ER_STAGE2_BOOT +0 0x100 {
compile_time_choice.o (+RO)
}
ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) {
}
}
LR_IROM1 0x10000100 FLASH_SIZE - ImageLength(LR_STAGE2_BOOT) { ; load region size_region
ER_FLASH +0 0x00200000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
* (+RO-DATA)
startup_RP2040.o (+RO)
}
ER_RAM_VECTOR_TABLE 0x20000000 {
* (.ram_vector_table)
}
ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE {
}
ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE {
}
ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE {
}
ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE {
}
ER_MUTEX_ARRAY +0 {
* (.mutex_array.*)
* (.mutex_array)
}
;ER_PREINIT_ARRAY +0 {
; * (.preinit_array.*)
; * (.preinit_array)
;}
RW_IRAM +0 RAMSIZE_VALID { ; RW data
.ANY (+RW +ZI)
* (+RO-CODE)
* (+XO)
}
RW_IRAM_NO_INIT +0 UNINIT {
.ANY (.bss.noinit)
}
}

View File

@ -0,0 +1,10 @@
FUNC void reset_pico(void)
{
exec("RESET");
exec("G, Reset_Handler");
}
DEFINE BUTTON "Reset Pico", "reset_pico()"
reset_pico();

View File

@ -0,0 +1,36 @@
FUNC void debug_from_ram(void)
{
//extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
printf("Entry Point: %08x\r\n", Reset_Handler);
printf("Main Stack Pointer: %08x\r\n", Image$$ARM_LIB_STACK$$ZI$$Limit);
/*
typedef struct {
unsigned int ctrl;
unsigned int load;
unsigned int reason;
unsigned int scratch[8];
unsigned int tick;
} watchdog_hw_t;
#define watchdog_hw ((watchdog_hw_t *const)0x40058000)
*/
_WWORD(0x4005801C ,0xb007c0d3); //! scratch 4
_WWORD(0x40058020 ,-0xb007c0d3 ^ (Reset_Handler | 0x01)); //! scratch 5
_WWORD(0x40058024 ,Image$$ARM_LIB_STACK$$ZI$$Limit); //! scratch 6
_WWORD(0x40058028 ,Reset_Handler | 0x01); //! scratch 7
exec("RESET");
//exec("BS main");
//exec("G, Reset_Handler");
exec("G, main");
}
DEFINE BUTTON "Reset Pico", "debug_from_ram()"
debug_from_ram();

File diff suppressed because it is too large Load Diff