Skip to content

Commit

Permalink
reset modules when user code started (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeR-na-r1 authored Dec 25, 2024
1 parent 20f8592 commit f4aea34
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
30 changes: 30 additions & 0 deletions compiler/library/tjc-ms1-btn-a2/1.0/source/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ extern "C" {

void SystemInit(void) {

// init modules
// GPIO (A, B, C, D, F)
// A
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOARST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOARST_Msk;

// B
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOBRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOBRST_Msk;

// C
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOCRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOCRST_Msk;

// D
RCC->IOPRSTR |= RCC_IOPRSTR_GPIODRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIODRST_Msk;

// F
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOFRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOFRST_Msk;

// USART1
RCC->APBRSTR2 |= RCC_APBRSTR2_USART1RST_Msk;
RCC->APBRSTR2 &= ~RCC_APBRSTR2_USART1RST_Msk;

// DMA
RCC->AHBRSTR |= RCC_AHBRSTR_DMA1RST_Msk;
RCC->AHBRSTR &= ~RCC_AHBRSTR_DMA1RST_Msk;

#define FLASH_BASE_ADDR 0x08003800
SCB->VTOR = FLASH_BASE_ADDR; //установка VECT_TAB_OFFSET
__enable_irq(); //включаем все прерывания TODO
Expand Down
30 changes: 30 additions & 0 deletions compiler/library/tjc-ms1-lmp-a3/1.0/source/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ extern "C" {

void SystemInit(void) {

// init modules
// GPIO (A, B, C, D, F)
// A
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOARST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOARST_Msk;

// B
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOBRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOBRST_Msk;

// C
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOCRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOCRST_Msk;

// D
RCC->IOPRSTR |= RCC_IOPRSTR_GPIODRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIODRST_Msk;

// F
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOFRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOFRST_Msk;

// USART1
RCC->APBRSTR2 |= RCC_APBRSTR2_USART1RST_Msk;
RCC->APBRSTR2 &= ~RCC_APBRSTR2_USART1RST_Msk;

// DMA
RCC->AHBRSTR |= RCC_AHBRSTR_DMA1RST_Msk;
RCC->AHBRSTR &= ~RCC_AHBRSTR_DMA1RST_Msk;

#define FLASH_BASE_ADDR 0x08003800
SCB->VTOR = FLASH_BASE_ADDR; //установка VECT_TAB_OFFSET
__enable_irq(); //включаем все прерывания TODO
Expand Down
30 changes: 30 additions & 0 deletions compiler/library/tjc-ms1-main-a4/1.0/source/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ extern "C" {

void SystemInit(void) {

// init modules
// GPIO (A, B, C, D, F)
// A
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOARST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOARST_Msk;

// B
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOBRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOBRST_Msk;

// C
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOCRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOCRST_Msk;

// D
RCC->IOPRSTR |= RCC_IOPRSTR_GPIODRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIODRST_Msk;

// F
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOFRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOFRST_Msk;

// USART1
RCC->APBRSTR2 |= RCC_APBRSTR2_USART1RST_Msk;
RCC->APBRSTR2 &= ~RCC_APBRSTR2_USART1RST_Msk;

// DMA
RCC->AHBRSTR |= RCC_AHBRSTR_DMA1RST_Msk;
RCC->AHBRSTR &= ~RCC_AHBRSTR_DMA1RST_Msk;

#define FLASH_BASE_ADDR 0x08003800
SCB->VTOR = FLASH_BASE_ADDR; //установка VECT_TAB_OFFSET
__enable_irq(); //включаем все прерывания TODO
Expand Down
30 changes: 30 additions & 0 deletions compiler/library/tjc-ms1-mtrx-a2/1.0/source/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ extern "C" {

void SystemInit(void) {

// init modules
// GPIO (A, B, C, D, F)
// A
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOARST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOARST_Msk;

// B
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOBRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOBRST_Msk;

// C
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOCRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOCRST_Msk;

// D
RCC->IOPRSTR |= RCC_IOPRSTR_GPIODRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIODRST_Msk;

// F
RCC->IOPRSTR |= RCC_IOPRSTR_GPIOFRST_Msk;
RCC->IOPRSTR &= ~RCC_IOPRSTR_GPIOFRST_Msk;

// USART2
RCC->APBRSTR1 |= RCC_APBRSTR1_USART2RST_Msk;
RCC->APBRSTR1 &= ~RCC_APBRSTR1_USART2RST_Msk;

// DMA
RCC->AHBRSTR |= RCC_AHBRSTR_DMA1RST_Msk;
RCC->AHBRSTR &= ~RCC_AHBRSTR_DMA1RST_Msk;

#define FLASH_BASE_ADDR 0x08003800
SCB->VTOR = FLASH_BASE_ADDR; //установка VECT_TAB_OFFSET
__enable_irq(); //включаем все прерывания TODO
Expand Down

0 comments on commit f4aea34

Please sign in to comment.