kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
445 stars 162 forks source link

Load RAM area in Core1's interrupt context to ensure the cache in Core0 is written back into RAM, instead of use iomen malloc. #118

Open jimaobian opened 3 years ago

jimaobian commented 3 years ago

Code in Core1 like this will ensure the cache in Core0 is written back into RAM.

void core1_interrupt_lock(){
    spinlock_lock(&mMultiInterruptLock);
}

void core1_interrupt_unlock(){
    spinlock_unlock(&mMultiInterruptLock);
}

int test(void *ctx){
    // printk("start\n");
    volatile uint8_t* ptr = lcd_get_color_p();
    if (ptr)
    {
        for (int i = 0; i < 2400; i++)
        {
            *ptr;
            ptr += 64;
        }
    }
    core1_interrupt_unlock();
}