SMART_COMPONENTS_AURUS/APP/main.c

94 lines
2.0 KiB
C

#include "cmsis_os.h"
#include "MainModesArbiter.h"
#include "at32f435_437_clock.h"
#include "PeripheralInterfaces.h"
#include "wdt_timer.h"
/// не проебать
//XTT316300S1012671
//XTT316300S1012862
//XTT316300S1012157
//XTT316300S1012191
// INTELCOM_BILD_FOR_SOUND_TEST
//подготовка не горит
// AT+CCMXPLAYWAV="E:/ecall_on.wav", 2
// bot +79418100029
// testNum sms +79418100025
// +79418100013 smsCener
/// +79043490000
// ecall_on
// 2.1.7
/// 79043490000 tele2 smscentr
//AT+CCMXPLAYWAV="E:/ant_error.wav", 2
// AT+CCMXPLAY="E:/tets_call_timeuot.mp3", 0, 0
// LE11B01SIM7600M22_CUS_AS
// 00000000000000000
_Noreturn void stop() {
while (1) {
asm("nop");
}
}
#define STOP stop();
// Переполнение стека
void vApplicationStackOverflowHook(TaskHandle_t xTask, signed char *pcTaskName) {
STOP
}
tMma MAIN_ENV;
#define sts(STR) STR, sizeof(STR)-1
void main_SetAccessProtection(){
flash_status_type status = FLASH_OPERATE_DONE;
if(flash_fap_status_get() == RESET) {
flash_unlock();
status = flash_operation_wait_for(OPERATION_TIMEOUT);
if (status != FLASH_OPERATE_TIMEOUT) {
if ((status == FLASH_PROGRAM_ERROR) || (status == FLASH_EPP_ERROR))
flash_flag_clear(FLASH_PRGMERR_FLAG | FLASH_EPPERR_FLAG);
status = flash_fap_enable(TRUE);
if (status == FLASH_OPERATE_DONE){
//nvic_system_reset();
}
flash_lock();
}
flash_lock();
}
}
#ifdef SET_ACCESS_PROTECTION
#define SetAccessProtection main_SetAccessProtection();
#else
#define SetAccessProtection //
#endif
#ifdef SET_WDT
#define SetWdt Wdt_Start();
#else
#define SetWdt //
#endif
int main(void) {
SetAccessProtection
system_clock_config();
osKernelInitialize();
InitPeripheralInterfaces();
Mma_Init(&MAIN_ENV, &GPIOS, &SERIAL_PORTS, &I2C_PORTS, &SPI_PORTS, &ADCS, &NVM_STORAGE, &RTCS, &CAN_PORTS);
Mma_StartThread(&MAIN_ENV);
SetWdt
osKernelStart();
STOP
}
#undef SetAccessProtection