remove dead code
This commit is contained in:
parent
eb39e0f2c4
commit
aece05b2e8
@ -25,12 +25,17 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL > 0
|
||||||
|
|
||||||
static uint32_t LOGMASK = TAG_FILENO;
|
static uint32_t LOGMASK = TAG_FILENO;
|
||||||
|
|
||||||
|
|
||||||
void set_logging_mask(uint32_t mask)
|
void set_logging_mask(uint32_t mask)
|
||||||
{
|
{
|
||||||
LOGMASK = mask;
|
LOGMASK = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct logtag
|
struct logtag
|
||||||
{
|
{
|
||||||
uint32_t tagn;
|
uint32_t tagn;
|
||||||
@ -108,3 +113,4 @@ void LOG_HEX(uint32_t tag, uint8_t * data, int length)
|
|||||||
set_logging_tag(tag);
|
set_logging_tag(tag);
|
||||||
dump_hex(data,length);
|
dump_hex(data,length);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...);
|
void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...);
|
||||||
void LOG_HEX(uint32_t tag, uint8_t * data, int length);
|
void LOG_HEX(uint32_t tag, uint8_t * data, int length);
|
||||||
void set_logging_mask(uint32_t mask);
|
|
||||||
void set_logging_tag(uint32_t tag);
|
void set_logging_tag(uint32_t tag);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -60,8 +60,9 @@ typedef enum
|
|||||||
TAG_FILENO = (1<<31)
|
TAG_FILENO = (1<<31)
|
||||||
} LOG_TAG;
|
} LOG_TAG;
|
||||||
|
|
||||||
#if DEBUG_LEVEL == 1
|
#if DEBUG_LEVEL > 0
|
||||||
|
|
||||||
|
void set_logging_mask(uint32_t mask);
|
||||||
#define printf1(tag,fmt, ...) LOG(tag & ~(TAG_FILENO), NULL, 0, fmt, ##__VA_ARGS__)
|
#define printf1(tag,fmt, ...) LOG(tag & ~(TAG_FILENO), NULL, 0, fmt, ##__VA_ARGS__)
|
||||||
#define printf2(tag,fmt, ...) LOG(tag | TAG_FILENO,__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
#define printf2(tag,fmt, ...) LOG(tag | TAG_FILENO,__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
||||||
#define printf3(tag,fmt, ...) LOG(tag | TAG_FILENO,__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
#define printf3(tag,fmt, ...) LOG(tag | TAG_FILENO,__FILE__, __LINE__, fmt, ##__VA_ARGS__)
|
||||||
@ -70,6 +71,7 @@ typedef enum
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#define set_logging_mask(mask)
|
||||||
#define printf1(fmt, ...)
|
#define printf1(fmt, ...)
|
||||||
#define printf2(fmt, ...)
|
#define printf2(fmt, ...)
|
||||||
#define printf3(fmt, ...)
|
#define printf3(fmt, ...)
|
||||||
|
@ -37,52 +37,18 @@
|
|||||||
uint8_t REBOOT_FLAG = 0;
|
uint8_t REBOOT_FLAG = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// void __attribute__((optimize("O0"))) BOOT_boot(void)
|
|
||||||
void BOOT_boot(void)
|
void BOOT_boot(void)
|
||||||
{
|
{
|
||||||
uint32_t sp;
|
|
||||||
typedef void (*pFunction)(void);
|
typedef void (*pFunction)(void);
|
||||||
pFunction jump;
|
|
||||||
|
|
||||||
|
|
||||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
|
||||||
/* Set MSION bit */
|
|
||||||
RCC->CR |= RCC_CR_MSION;
|
|
||||||
|
|
||||||
/* Reset CFGR register */
|
|
||||||
RCC->CFGR = 0x00000000U;
|
|
||||||
|
|
||||||
/* Reset HSEON, CSSON , HSION, and PLLON bits */
|
|
||||||
RCC->CR &= 0xEAF6FFFFU;
|
|
||||||
|
|
||||||
/* Reset PLLCFGR register */
|
|
||||||
RCC->PLLCFGR = 0x00001000U;
|
|
||||||
|
|
||||||
/* Reset HSEBYP bit */
|
|
||||||
RCC->CR &= 0xFFFBFFFFU;
|
|
||||||
|
|
||||||
/* Disable all interrupts */
|
|
||||||
RCC->CIER = 0x00000000U;
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t *bootAddress = (uint32_t *)(APPLICATION_JUMP_ADDR);
|
uint32_t *bootAddress = (uint32_t *)(APPLICATION_JUMP_ADDR);
|
||||||
|
|
||||||
printf("stack addr: %02lx\r\n",bootAddress[0]);
|
|
||||||
printf("jmp addr: %02lx\r\n",bootAddress[1]);
|
|
||||||
|
|
||||||
/* Set new vector table */
|
/* Set new vector table */
|
||||||
SCB->VTOR = APPLICATION_JUMP_ADDR;
|
SCB->VTOR = APPLICATION_JUMP_ADDR;
|
||||||
|
|
||||||
/* Read new SP and PC from vector table */
|
/* Read new SP and PC from vector table */
|
||||||
sp = bootAddress[0];
|
__set_MSP(bootAddress[0]);
|
||||||
jump = (pFunction)bootAddress[1];
|
((pFunction)bootAddress[1])();
|
||||||
|
|
||||||
/* Do a jump by loading the PC and SP into the CPU registers */
|
|
||||||
__set_MSP(sp);
|
|
||||||
jump();
|
|
||||||
//jmp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user