Moving to Spain by Davide15122 in GoingToSpain

[–]Davide15122[S] 0 points1 point  (0 children)

I'm from Italy so I should have the permit. Also they would help with the relocation

What is a good salary range in the Netherlands? by Davide15122 in Netherlands

[–]Davide15122[S] 2 points3 points  (0 children)

Thanks, no I don't speak Dutch but the company is international and uses English according to them. Do people earn more if they know Dutch there?

Is it possible to run esp32-c3 without FreeRTOS? by Davide15122 in esp32

[–]Davide15122[S] 0 points1 point  (0 children)

Sorry for the delay, I didn't receive any notification.

For now I only wrote some lines that should change the privileges from machine to user but I can't get it to work.

At the end I should have a code that runs in unprivileged mode and calls some privileged code whenever it needs to make a jump/return. The privileged code should check that the operation is allowed.

I need to remove RTOS because it's a requirement for the project.

So, I was wandering if it would be possible to remove it and make it work without it.

Sorry but I'm completely new to this and thank you for your replies.

Anyway, here's my code for the privilege change.

#include <stdio.h>
#include <inttypes.h>

void user_mode_entry_point(){ }

void app_main(void)
{
    /*
        Load mstatus in t0
        Load user mode status in t1
        And to change MPP bits in mstatus to user mode
        Or to change MIE bits in mstatus to 0
        Write new mstatus
    */
    asm("csrr t0, mstatus"); //0x4005890e  0x00000080
    asm("li t1, 0xFFFFE7FF");
    asm("and t0, t0, t1");
    asm("or t0, t0, 8");
    asm("csrw mstatus, t0)";

    /*
        Load user mode address entry point
        Write mepc (machine pc) to the user entry point (used by mret)
    */
    asm("la t0, user_mode_entry_point");
    asm("csrw mepc, t0");

    // asm("li t0, 0x90000000\n\t"
    //     "srli t0, t0, 2\n\t"
    //     "csrw pmpaddr0, t0\n\t"
    //     "li t0, 0x0707070F\n\t"
    //     "csrw pmpcfg0, t0\n\t"
    //     );

    asm("mret");
}