1 /* 2 // Copyright (C) 2022 Beken Corporation 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include"platform.h" 17 #include "cache.h" 18 #include <os/os.h> 19 #include "reset_reason.h" 20 #include "bk_pm_internal_api.h" 21 #include "boot.h" 22 23 extern void c_startup(void); 24 extern void system_init(void); 25 extern void __libc_init_array(void); 26 extern void init_pmp_config(); 27 extern void entry_main(void); 28 extern void UartDbgInit(); 29 extern int print_str(char * st); 30 31 //volatile int g_test_mode = 1; 32 close_wdt(void)33void close_wdt(void) 34 { 35 /*close the wdt*/ 36 *((volatile unsigned long *) (0x44000600)) = 0x5A0000; 37 *((volatile unsigned long *) (0x44000600)) = 0xA50000; 38 *((volatile unsigned long *) (0x44800000)) = 0x5A0000; 39 *((volatile unsigned long *) (0x44800000)) = 0xA50000; 40 } 41 //volatile int g_debug_mode=1; reset_handler(void)42void reset_handler(void) 43 { 44 /// TODO: DEBUG VERSION close the wdt 45 close_wdt(); 46 47 //while(g_test_mode); 48 49 #if (!CONFIG_SLAVE_CORE) 50 sram_dcache_map(); 51 #endif 52 53 /* 54 * Initialize LMA/VMA sections. 55 * Relocation for any sections that need to be copied from LMA to VMA. 56 */ 57 c_startup(); 58 59 /*power manager init*/ 60 pm_hardware_init(); 61 62 #if (CONFIG_SOC_BK7256XX) 63 //clear mannully reboot flag 64 set_reboot_tag(0); 65 #endif 66 67 /* Call platform specific hardware initialization */ 68 system_init(); 69 //while(g_debug_mode){}; 70 71 /* Do global constructors */ 72 __libc_init_array(); 73 74 /*Init pmp configuration*/ 75 init_pmp_config(); 76 77 /* Entry function */ 78 entry_main(); 79 80 } 81