milkv-duo/duo-8051

Some issues for the Duo 256M

Opened this issue · 0 comments

In the guide it says to download firmware.zip. In that file there is a pre-compiled version of 8051_up. But that one doesn't work. You have to compile it yourself using the SDK which can be found here. The code for 8051_up is located in duo-8051/tools/8051_up/ of the duo-8051 github (i.e. this repository).

The guide says to Copy 8051_up, mars_mcu_fw.bin, and blink.sh into /mnt/data, and grant execution and read permissions but you also need to copy the file '8051_boot_cfg.ini' which can be found in the file firmware.zip.

In the file 8051_up.c mentioned above, is the line #define MCU_FW_PATH "/lib/firmware/mars_mcu_fw.bin". This means that the 8051_up expects your executable to be located in the directory /lib/firmware/ instead of /mnt/data/. So, you can either create that directory and place your executable there, or change the line in 8051_up.c and recompile.

The base_project of this repository should toggle the blue led on the board when using blink.sh from firmware.zip. It doesn't for the Duo 256M. The problem is the GPIO numbering and memory address to be used in code. The solution was to add the line #define GPIO4_BASE 0x05021000 in the file cvi_gpio.h of the base_project. And in the file main.c the lines at case 0x6: and case 0x7 should be changed into:

                 case 0x6: /* gpio_high */
                        set_gpio_direction(GPIO4_BASE,2,GPIO_DIRECTION_OUT);
                        set_gpio_level(GPIO4_BASE,2,GPIO_LEVEL_HIGH);
                        mmio_write_32(RTC_INFO1, 0xff);
                        printf("LED_GPIO->HIGH\n");
                        break;

                case 0x7: /* gpio_low */
                        set_gpio_direction(GPIO4_BASE,2,GPIO_DIRECTION_OUT);
                        set_gpio_level(GPIO4_BASE,2,GPIO_LEVEL_LOW);
                        mmio_write_32(RTC_INFO1, 0xff);
                        printf("LED_GPIO->LOW\n");
                        break;

Note the use of GPIO4_BASE and pin number 2. Also note that the name 'GPIO4' is probably technically not correct, but it doesn't really matter.