/* * application_jump() - Jump to application * * INPUT * none * OUTPUT * none * */ static void application_jump(void) { uint32_t entry_address = FLASH_APP_START + 4; uint32_t app_entry_address = (uint32_t)(*(uint32_t *)(entry_address)); app_entry_t app_entry = (app_entry_t)app_entry_address; app_entry(); }
status_t BIconButton::SetIcon(const char* pathToBitmap) { if (pathToBitmap == NULL) return B_BAD_VALUE; status_t status = B_BAD_VALUE; BBitmap* fileBitmap = NULL; // try to load bitmap from either relative or absolute path BEntry entry(pathToBitmap, true); if (!entry.Exists()) { app_info info; status = be_app->GetAppInfo(&info); if (status == B_OK) { BEntry app_entry(&info.ref, true); BPath path; app_entry.GetPath(&path); status = path.InitCheck(); if (status == B_OK) { status = path.GetParent(&path); if (status == B_OK) { status = path.Append(pathToBitmap, true); if (status == B_OK) fileBitmap = BTranslationUtils::GetBitmap(path.Path()); else { printf("BIconButton::SetIcon() - path.Append() failed: " "%s\n", strerror(status)); } } else { printf("BIconButton::SetIcon() - path.GetParent() failed: " "%s\n", strerror(status)); } } else { printf("BIconButton::SetIcon() - path.InitCheck() failed: " "%s\n", strerror(status)); } } else { printf("BIconButton::SetIcon() - be_app->GetAppInfo() failed: " "%s\n", strerror(status)); } } else fileBitmap = BTranslationUtils::GetBitmap(pathToBitmap); if (fileBitmap) { status = _MakeBitmaps(fileBitmap); delete fileBitmap; } else status = B_ERROR; return status; }
static void jump_to_app(uint32_t address) { uint32_t jump_addr = *(volatile uint32_t*)(address + 0x04); /* reset ptr in vector table */ app_entry_t app_entry = (app_entry_t)jump_addr; /* Reset all interrupts to default */ chSysDisable(); /* Clear pending interrupts just to be on the safe side */ SCB_ICSR = ICSR_PENDSVCLR; /* Disable all interrupts */ int i; for(i = 0; i < 8; ++i) NVIC->ICER[i] = NVIC->IABR[i]; /* Set stack pointer as in application's vector table */ __set_MSP(*(volatile uint32_t*)address); app_entry(); }