Skip to content

Commit

Permalink
[board] merge basic syterboot
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzukiTsuru committed Jan 13, 2024
1 parent 0a15353 commit c5a3f93
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 27 deletions.
4 changes: 3 additions & 1 deletion board/100ask-ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ add_subdirectory(hello_world)

add_subdirectory(init_dram)

add_subdirectory(smhc_test)
add_subdirectory(smhc_test)

add_subdirectory(syter_boot)
14 changes: 13 additions & 1 deletion board/100ask-ros/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,16 @@ sunxi_i2c_t i2c_pmu = {
.speed = 4000000,
.gpio_scl = {GPIO_PIN(GPIO_PORTL, 0), GPIO_PERIPH_MUX2},
.gpio_sda = {GPIO_PIN(GPIO_PORTL, 1), GPIO_PERIPH_MUX2},
};
};

void clean_syterkit_data(void) {
/* Disable MMU, data cache, instruction cache, interrupts */
arm32_mmu_disable();
printk(LOG_LEVEL_INFO, "disable mmu ok...\n");
arm32_dcache_disable();
printk(LOG_LEVEL_INFO, "disable dcache ok...\n");
arm32_icache_disable();
printk(LOG_LEVEL_INFO, "disable icache ok...\n");
arm32_interrupt_disable();
printk(LOG_LEVEL_INFO, "free interrupt ok...\n");
}
Binary file modified board/100ask-ros/syter_boot/bl31/bl31.bin
Binary file not shown.
34 changes: 10 additions & 24 deletions board/100ask-ros/syter_boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#define CONFIG_BL31_FILENAME "bl31.bin"
#define CONFIG_BL31_LOAD_ADDR (0x48000000)

#define CONFIG_UBOOT_FILENAME "u-boot.bin"
#define CONFIG_UBOOT_LOAD_ADDR (0x4a000000)

#define CONFIG_DTB_FILENAME "sunxi.dtb"
#define CONFIG_DTB_LOAD_ADDR (0x4a200000)

Expand Down Expand Up @@ -75,9 +72,6 @@ typedef struct {
uint8_t *bl31_dest;
char bl31_filename[FILENAME_MAX_LEN];

uint8_t *uboot_dest;
char uboot_filename[FILENAME_MAX_LEN];

uint8_t *kernel_dest;
char kernel_filename[FILENAME_MAX_LEN];

Expand Down Expand Up @@ -145,9 +139,7 @@ static int load_sdcard(image_info_t *image) {
start = time_ms();
sdmmc_blk_read(&card0, (uint8_t *) (SDRAM_BASE), 0, CONFIG_SDMMC_SPEED_TEST_SIZE);
test_time = time_ms() - start;
printk(LOG_LEVEL_DEBUG, "SDMMC: speedtest %uKB in %ums at %uKB/S\n",
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / 1024, test_time,
(CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / test_time);
printk(LOG_LEVEL_DEBUG, "SDMMC: speedtest %uKB in %ums at %uKB/S\n", (CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / 1024, test_time, (CONFIG_SDMMC_SPEED_TEST_SIZE * 512) / test_time);

start = time_ms();

Expand All @@ -166,11 +158,6 @@ static int load_sdcard(image_info_t *image) {
if (ret)
return ret;

// printk(LOG_LEVEL_INFO, "FATFS: read %s addr=%x\n", image->uboot_filename, (uint32_t) image->uboot_dest);
// ret = fatfs_loadimage(image->uboot_filename, image->uboot_dest);
// if (ret)
// return ret;

printk(LOG_LEVEL_INFO, "FATFS: read %s addr=%x\n", image->of_filename, (uint32_t) image->of_dest);
ret = fatfs_loadimage(image->of_filename, image->of_dest);
if (ret)
Expand Down Expand Up @@ -213,16 +200,16 @@ void jmp_to_arm64(uint32_t addr) {
goto _loop;
}

void set_pmu_fin_voltage(char *power_name, uint32_t voltage) {
static void set_pmu_fin_voltage(char *power_name, uint32_t voltage) {
int set_vol = voltage;
int temp_vol, src_vol = pmu_axp1530_get_vol(&i2c_pmu, power_name);
int temp_vol, src_vol = pmu_axp2202_get_vol(&i2c_pmu, power_name);
if (src_vol > voltage) {
for (temp_vol = src_vol; temp_vol >= voltage; temp_vol -= 50) {
pmu_axp1530_set_vol(&i2c_pmu, power_name, temp_vol, 1);
pmu_axp2202_set_vol(&i2c_pmu, power_name, temp_vol, 1);
}
} else if (src_vol < voltage) {
for (temp_vol = src_vol; temp_vol <= voltage; temp_vol += 50) {
pmu_axp1530_set_vol(&i2c_pmu, power_name, temp_vol, 1);
pmu_axp2202_set_vol(&i2c_pmu, power_name, temp_vol, 1);
}
}
mdelay(30); /* Delay 300ms for pmu bootup */
Expand All @@ -239,12 +226,13 @@ int main(void) {

sunxi_i2c_init(&i2c_pmu);

pmu_axp1530_init(&i2c_pmu);

set_pmu_fin_voltage("dcdc2", 1100);
pmu_axp2202_init(&i2c_pmu);

set_pmu_fin_voltage("dcdc1", 1100);
set_pmu_fin_voltage("dcdc3", 1100);

pmu_axp2202_dump(&i2c_pmu);

/* Initialize the DRAM and enable memory management unit (MMU). */
uint64_t dram_size = sunxi_dram_init(NULL);

Expand All @@ -257,12 +245,10 @@ int main(void) {
memset(&image, 0, sizeof(image_info_t));

image.bl31_dest = (uint8_t *) CONFIG_BL31_LOAD_ADDR;
image.uboot_dest = (uint8_t *) CONFIG_UBOOT_LOAD_ADDR;
image.of_dest = (uint8_t *) CONFIG_DTB_LOAD_ADDR;
image.kernel_dest = (uint8_t *) CONFIG_KERNEL_LOAD_ADDR;

strcpy(image.bl31_filename, CONFIG_BL31_FILENAME);
strcpy(image.uboot_filename, CONFIG_UBOOT_FILENAME);
strcpy(image.of_filename, CONFIG_DTB_FILENAME);
strcpy(image.kernel_filename, CONFIG_KERNEL_FILENAME);

Expand All @@ -288,7 +274,7 @@ int main(void) {

atf_head_t *atf_head = (atf_head_t *) image.bl31_dest;

atf_head->next_boot_base = CONFIG_UBOOT_LOAD_ADDR;
atf_head->next_boot_base = CONFIG_KERNEL_LOAD_ADDR;
atf_head->dtb_base = CONFIG_DTB_LOAD_ADDR;

printk(LOG_LEVEL_INFO, "ATF: jump_instruction: 0x%08x\n", atf_head->jump_instruction);
Expand Down
Binary file removed board/100ask-ros/syter_boot/u-boot/sunxi.dtb
Binary file not shown.
Binary file removed board/100ask-ros/syter_boot/u-boot/u-boot.bin
Binary file not shown.
1 change: 0 additions & 1 deletion src/image/bimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ int bImage_loader(uint8_t *addr, uint32_t *entry) {
printk(LOG_LEVEL_DEBUG, "[IMG] kernel magic is ok\n");
printk(LOG_LEVEL_DEBUG, "[IMG] kernel_size = 0x%x\n", image_header->kernel_size);
printk(LOG_LEVEL_DEBUG, "[IMG] ramdisk_size = 0x%x\n", image_header->ramdisk_size);
rbytes = image_header->kernel_size + image_header->ramdisk_size + image_header->second_size + 4 * 1024 + 511;
} else {
printk(LOG_LEVEL_ERROR, "[IMG] kernel 0x%08x magic is error\n", addr);
return -1;
Expand Down

0 comments on commit c5a3f93

Please sign in to comment.