Compare commits
6 commits
8bde6dd87b
...
2b308a6b1d
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b308a6b1d | |||
| b3ef3769d9 | |||
| d9918291ae | |||
| 6f191ce44c | |||
| 42465b22f4 | |||
| d1891143e3 |
7 changed files with 73 additions and 12 deletions
|
|
@ -14,6 +14,13 @@ if(NOT UNIT_TESTING)
|
|||
target_link_libraries(module_name
|
||||
RegEdit
|
||||
)
|
||||
|
||||
#These get defined in the toolchain files.
|
||||
target_compile_options(module_name PUBLIC
|
||||
${OBJECT_GEN_FLAGS}
|
||||
${C_FLAGS_ARCH}
|
||||
)
|
||||
|
||||
else()
|
||||
target_include_directories(module_name PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ that can be used for development.
|
|||
|
||||
- [X] Add ch32v003fun sources.
|
||||
- [X] Add example blinky default main.
|
||||
- [ ] Add useful test examples.
|
||||
- [X] Add useful test examples.
|
||||
- [ ] Add useful mock examples.
|
||||
- [X] Get Blinky to run on hardware.
|
||||
- [ ] Set conditional compile/linker flags?
|
||||
|
|
|
|||
|
|
@ -119,6 +119,14 @@ set(C_FLAGS_ARCH "\
|
|||
-I${ALTCLIB};\
|
||||
-nostdlib")
|
||||
|
||||
# For CH32V006/002/005(QingKeV)
|
||||
|
||||
# For CH32V20X(QingKeV)
|
||||
|
||||
# For CH32V30X(QingKeV)
|
||||
|
||||
# For CH32X03X(QingKeV)
|
||||
|
||||
#-------------------
|
||||
# CFLAGS
|
||||
#-------------------
|
||||
|
|
@ -149,7 +157,6 @@ UNSET(CMAKE_CXX_FLAGS CACHE)
|
|||
#set(LINKER_SCRIPT "./src/ch32v003.ld")
|
||||
#set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/src/linker_script.ld")
|
||||
|
||||
#set(LD_FLAGS "-lgcc")
|
||||
set(LD_FLAGS " \
|
||||
-Wl,--print-memory-usage \
|
||||
-Wl,-Map=${PROJECT_NAME}.map \
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@ if(NOT UNIT_TESTING)
|
|||
target_link_libraries(ADC
|
||||
RegEdit
|
||||
)
|
||||
|
||||
target_compile_options(ADC PUBLIC
|
||||
${OBJECT_GEN_FLAGS}
|
||||
${C_FLAGS_ARCH}
|
||||
)
|
||||
|
||||
else()
|
||||
target_include_directories(ADC PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
|
|
|
|||
|
|
@ -16,18 +16,10 @@ if(NOT UNIT_TESTING)
|
|||
)
|
||||
|
||||
target_compile_options(wwdg PUBLIC
|
||||
-g
|
||||
-Os
|
||||
-flto
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
-fmessage-length=0
|
||||
-msmall-data-limit=8
|
||||
-march=rv32ec
|
||||
-mabi=ilp32e
|
||||
${OBJECT_GEN_FLAGS}
|
||||
${C_FLAGS_ARCH}
|
||||
)
|
||||
|
||||
|
||||
else()
|
||||
target_include_directories(wwdg PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# Description: mocks for wwdg cmake config.
|
||||
# File: /tests/wwdg/mocks/CMakesList.txt
|
||||
|
||||
add_library(wwdg_mock STATIC
|
||||
wwdg_hw.c
|
||||
)
|
||||
|
||||
target_include_directories(wwdg_mock PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
|
||||
37
tests/wwdg/mocks/wwdg_hw.h
Normal file
37
tests/wwdg/mocks/wwdg_hw.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef WWDG_MOCK_H
|
||||
#define WWDG_MOCK_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Stuff that we have globally.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool is_enabled;
|
||||
bool is_HSE;
|
||||
uint32_t clock_rate;
|
||||
}RISCV_APB_CLK;
|
||||
|
||||
/* Window WatchDog Registers*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t CTLR; /* Control Register */
|
||||
uint16_t RESERVED1;
|
||||
uint16_t CFGR; /* Configuration Register */
|
||||
uint16_t RESERVED2;
|
||||
uint16_t STATR; /* Status Register */
|
||||
} WWDG_TypeDef;
|
||||
|
||||
|
||||
|
||||
void wwdg_mock_setup(WWDG_TypeDef *wwdg);
|
||||
|
||||
void wwdg_mock_reset(void);
|
||||
|
||||
void wwdg_mock_clock_tick(void);
|
||||
|
||||
void wwdg_mock_tick_n_times(size_t n);
|
||||
|
||||
#endif //WWDG_MOCK_H
|
||||
Loading…
Add table
Reference in a new issue