minor cleanup and moves prior to adding USB support

This commit is contained in:
true 2024-11-06 19:15:40 -08:00
parent 50ab3fd036
commit a903464666
17 changed files with 96 additions and 51 deletions

View File

@ -112,11 +112,53 @@
</tool> </tool>
</toolChain> </toolChain>
</folderInfo> </folderInfo>
<fileInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074.532442047" name="startup_ch32v20x_D8.S" rcbsApplicability="disable" resourcePath="startup/startup_ch32v20x_D8.S" toolsToInvoke="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189.389477860"> <folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074.1878244886" name="/" resourcePath="usblib">
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189.389477860" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189"/> <toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.1710558409" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release" unusedChildren="">
</fileInfo> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988.2145605707" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.1983282875.884036961" name="Create extended listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.1983282875"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.1000761142.1471696255" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.1000761142"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.514997414.1039447991" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.514997414"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.1008570639.1212783638" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.1008570639"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.467272439.958206657" name="'char' is signed (-fsigned-char)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.467272439"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.2047756949.1280887830" name="Function sections (-ffunction-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.2047756949"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.207613650.1683528972" name="Data sections (-fdata-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.207613650"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.1204865254.793107653" name="Debug level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.1204865254"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.867779652.1243330783" name="Debug format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.867779652"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.1900297968.1124367170" name="Architecture" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.1900297968"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.387605487.1264749708" name="Integer ABI" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.387605487"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.1509705449.795846175" name="Multiply extension (RVM)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.1509705449"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.1038505275.774925122" name="Compressed extension (RVC)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.1038505275"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.1218760634.1235930814" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.1218760634"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.103341323.147895903" name="Prefix" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.103341323"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.487601824.2014471558" name="C compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.487601824"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1062130429.1040878445" name="C++ compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1062130429"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.1194282993.1869526196" name="Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.1194282993"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.1529355265.1048628780" name="Hex/Bin converter" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.1529355265"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1053750745.623055541" name="Listing generator" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1053750745"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.1441326233.726775080" name="Size command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.1441326233"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.550105535.1399812986" name="Build command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.550105535"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.719280496.1282520024" name="Remove command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.719280496"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.226017994.514189323" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.226017994"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.1590833110.1132072493" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.1590833110"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.warnings.unused.1961191588.486019826" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.warnings.unused.1961191588"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.warnings.uninitialized.929829166.1568624332" name="Warn on uninitialized variables (-Wuninitialized)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.warnings.uninitialized.929829166"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.438890136.1901677275" name="No common unitialized (-fno-common)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.438890136"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw.1540402642.712910497" name="Extra Compressed extension (RVXW)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw.1540402642"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore.813643495.2121388674" name="Small prologue/epilogue (-msave-restore)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore.813643495"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc.536610708.1323100297" name="RISC-V Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc.536610708"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.655804508" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.224923805" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1731377187"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler.646847908" name="GNU RISC-V Cross C++ Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler.1610882921"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.1823469555" name="GNU RISC-V Cross C Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.1620074387"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker.1630677550" name="GNU RISC-V Cross C++ Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker.1947503520"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1342374175" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1292785366"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.2069256623" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.1801165667"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.290530051" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.1356766765"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.258914608" name="GNU RISC-V Cross Print Size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.712424314"/>
</toolChain>
</folderInfo>
<sourceEntries> <sourceEntries>
<entry excluding="startup/startup_ch32v20x_D8.S|startup/startup_ch32v20x_D8W.S|Startup/startup_ch32v20x_D8W.S|Startup/startup_ch32v20x_D8.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> <entry excluding="usblib|Startup/startup_ch32v20x_D8W.S|startup/startup_ch32v20x_D8W.S|Startup/startup_ch32v20x_D8.S|startup/startup_ch32v20x_D8.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@ -138,4 +180,9 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="build_dbg">
<resource resourceType="PROJECT" workspacePath="/gat_stand_fw"/>
</configuration>
</storageModule>
</cproject> </cproject>

View File

@ -23,9 +23,7 @@ void HardFault_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
*/ */
void NMI_Handler(void) void NMI_Handler(void)
{ {
while (1) while (1);
{
}
} }
/********************************************************************* /*********************************************************************
@ -37,9 +35,7 @@ void NMI_Handler(void)
*/ */
void HardFault_Handler(void) void HardFault_Handler(void)
{ {
while (1) while (1);
{
}
} }

View File

@ -12,7 +12,6 @@
#ifndef __CH32V20x_IT_H #ifndef __CH32V20x_IT_H
#define __CH32V20x_IT_H #define __CH32V20x_IT_H
#include "debug.h"
#endif /* __CH32V20x_IT_H */ #endif /* __CH32V20x_IT_H */

View File

@ -12,12 +12,12 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include "src/adc.h" #include "periph/adc.h"
#include "src/btn.h" #include "periph/btn.h"
#include "src/gat_gpio.h" #include "periph/gat_gpio.h"
#include "src/port_pwr.h" #include "periph/port_pwr.h"
#include "src/rgbled.h" #include "periph/rgbled.h"
#include "src/rtc.h" #include "periph/rtc.h"
@ -169,9 +169,11 @@ int main(void)
// initialize light sense stuff // initialize light sense stuff
adc_init(); adc_init();
// finally, get the system tick interrupt going // get the system tick interrupt going
systick_init(); systick_init();
// initialize USB device for console shell
// let's do this // let's do this
while (1) { while (1) {
__WFI(); __WFI();

View File

@ -9,7 +9,7 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include <stdint.h> #include <stdint.h>
#include "adc.h" #include "periph/adc.h"

View File

@ -5,8 +5,8 @@
* Author: true * Author: true
*/ */
#ifndef USER_SRC_ADC_H_ #ifndef USER_PERIPH_ADC_H_
#define USER_SRC_ADC_H_ #define USER_PERIPH_ADC_H_
@ -49,4 +49,4 @@ uint8_t adc_get_lsens_coarse();
#endif /* USER_SRC_ADC_H_ */ #endif /* USER_PERIPH_ADC_H_ */

View File

@ -8,7 +8,7 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include "btn.h" #include "periph/btn.h"

View File

@ -2,8 +2,8 @@
* btn.h * btn.h
*/ */
#ifndef USER_SRC_BTN_H_ #ifndef USER_PERIPH_BTN_H_
#define USER_SRC_BTN_H_ #define USER_PERIPH_BTN_H_
@ -60,4 +60,4 @@ void btn_poll();
#endif /* USER_SRC_BTN_H_ */ #endif /* USER_PERIPH_BTN_H_ */

View File

@ -6,7 +6,7 @@
*/ */
#include "gat_gpio.h" #include "periph/gat_gpio.h"

View File

@ -5,8 +5,8 @@
* Author: true * Author: true
*/ */
#ifndef USER_SRC_GAT_GPIO_H_ #ifndef USER_PERIPH_GAT_GPIO_H_
#define USER_SRC_GAT_GPIO_H_ #define USER_PERIPH_GAT_GPIO_H_
@ -25,4 +25,4 @@ void gat_gpio_init();
#endif /* USER_SRC_GAT_GPIO_H_ */ #endif /* USER_PERIPH_GAT_GPIO_H_ */

View File

@ -8,7 +8,8 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include "port_pwr.h"
#include "periph/port_pwr.h"

View File

@ -5,8 +5,8 @@
* Author: true * Author: true
*/ */
#ifndef USER_SRC_PORT_PWR_H_ #ifndef USER_PERIPH_PORT_PWR_H_
#define USER_SRC_PORT_PWR_H_ #define USER_PERIPH_PORT_PWR_H_
@ -43,4 +43,4 @@ uint8_t usb2_pwr_state();
#endif /* USER_SRC_PORT_PWR_H_ */ #endif /* USER_PERIPH_PORT_PWR_H_ */

View File

@ -13,10 +13,9 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include <stdint.h> #include <stdint.h>
#include "btn.h" #include "periph/btn.h"
#include "port_pwr.h" #include "periph/port_pwr.h"
#include "rtc.h" #include "periph/rtc.h"

View File

@ -5,8 +5,8 @@
* Author: true * Author: true
*/ */
#ifndef USER_SRC_RGBLED_H_ #ifndef USER_PERIPH_RGBLED_H_
#define USER_SRC_RGBLED_H_ #define USER_PERIPH_RGBLED_H_
@ -22,4 +22,4 @@ void rgbled_update();
#endif /* USER_SRC_RGBLED_H_ */ #endif /* USER_PERIPH_RGBLED_H_ */

View File

@ -9,7 +9,7 @@
#include <ch32v20x.h> #include <ch32v20x.h>
#include <stdint.h> #include <stdint.h>
#include "rtc.h" #include "periph/rtc.h"

View File

@ -5,8 +5,8 @@
* Author: true * Author: true
*/ */
#ifndef USER_SRC_RTC_H_ #ifndef USER_PERIPH_RTC_H_
#define USER_SRC_RTC_H_ #define USER_PERIPH_RTC_H_
#include <stdint.h> #include <stdint.h>
@ -53,4 +53,4 @@ int8_t rtc_set_clock(struct RTClock *c);
#endif /* USER_SRC_RTC_H_ */ #endif /* USER_PERIPH_RTC_H_ */

View File

@ -9,24 +9,25 @@
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
#ifndef __SYSTEM_ch32v20x_H #ifndef __SYSTEM_CH32V20x_H
#define __SYSTEM_ch32v20x_H #define __SYSTEM_CH32V20x_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/* System_Exported_Functions */ /* System_Exported_Functions */
extern void SystemInit(void); extern void SystemInit(void);
extern void SystemCoreClockUpdate(void); extern void SystemCoreClockUpdate(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /*__CH32V20x_SYSTEM_H */ #endif /* __SYSTEM_CH32V20x_H */