Code Monkey home page Code Monkey logo

avr-os's People

Contributors

chrismoos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avr-os's Issues

Saving context of the RAMPZ and EIND registers

I have noticed that you don't save RAMPZ and EIND registers during a context switch. RAMPZ can be important when reading data from flash that is located at high addresses (REF: Section 7.6.1 in the ATMega640-1280-2560 datasheet). This seems like it would be problematic if their is a context switch between two processes attempting to access strings that have been stored with the PRGMEM attribute.

If you agree this is the case, let me know and I'll look at making a patch for this issue.

Struct & type name collision (mutex_t)

There is a name collision between the mutex_t struct and the mutex_t type. Correction is easy by renaming the struct into mutex_s but I don't know how to propose a commit (git commit seems not working).

Problem about Readme semple code

@chrismoos

i have a problem using your code. i run the code in Readme but trap in setup. here is my code:

#include <Arduino.h>

#include <util/delay.h>

extern "C" {
    #include <os.h>
}

spinlock_t testLock;

void kernel_task(void *arg) {
    while(1) {
        spinlock_acquire(&testLock);
        Serial.println("kernel: " + String((long)os_get_uptime()));
        spinlock_release(&testLock);
        os_sleep(1000);
    }
}

void user_task(void *arg) {
    int x = 0;
    while(1) {
        spinlock_acquire(&testLock);
        Serial.println("user_task: " + String(x++));
        spinlock_release(&testLock);
        os_sleep(5000);
    }
}

void setup() {
    Serial.begin(9600);
    Serial.print("Begin.\n");
    os_init();
}

void loop() {
    spinlock_init(&testLock);

    os_schedule_task(kernel_task, NULL, 0);
    os_schedule_task(user_task, NULL, 0);
    os_loop(); 
}

and here is the result keep running the setup:
image

i am using arduino mega2560. and i put your code in Arduino/libraries/os.

Makefile enhance

Hi, Chris Moos

I realize that we need to input "make DEVICE=arduino_*" everytime we make
and I do some change on Makefile, it will prompt and take input from user

btw, I also make changes on arduino/common.mk too...
as I added Include path on compile flags

I will send u the diff file later.

Regards,
Chalos

Can't execute sample code on Mega2560

Hi @chrismoos

I facing a problem when running sample code on Mega2560, which it's works on Uno.

Sample Code:

#include "Arduino.h"
#include <Wire.h> 
#include "LiquidCrystal/LiquidCrystal_I2C.h"
#include <util/delay.h>

extern "C" {
    #include "avros/os.h"
}
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

spinlock_t mutex;

void kernel_task(void *arg) {
    while(1) {
        spinlock_acquire(&mutex);
        lcd.setCursor(0, 0);
        lcd.print("kernel: " + String((long)os_get_uptime()));
        spinlock_release(&mutex);
        os_sleep(1000);
    }
}

void user_task(void *arg) {
    int x = 0;
    while(1) {
        spinlock_acquire(&mutex);
        lcd.setCursor(0, 1);
        lcd.print("user_task: " + String(x++));
        spinlock_release(&mutex);
        os_sleep(2000);
    }
}

void setup() {
    lcd.begin(16, 2);
    lcd.print("...");
    os_init();
}

void loop() {
    spinlock_init(&mutex);
    os_schedule_task(kernel_task, NULL, 0);
    os_schedule_task(user_task, NULL, 1);
    os_loop();
}

This is the result when running on Mega2560, it is stucking after calling os_init()
image

But same code run on Uno, it is works...
image

Thanks.

Chalos

Unable to make avr-os working on Uno

Hi !

I'm very interested by avr-os (and multitasking on Arduino).

I downloaded the whole library (by a "git clone...") and tested the example. By the way, I have an Arduino UNO with a LCD wired as needed. While the sketch compiles fine, he does not work at all and lock the Arduino. I use arduino 1.0.1 on Debian Linux.

I tried to comment some lines to try to find the failing statement(s) and I found that it is sufficent to include the "os.h" (and then to compile the *.c files) to lock the Arduino.

I'll investigate deeper to try to find out where exactly is the problem, but I'd like to know if this library has already be tested on a Arduino UNO. I wonder if there is a potential limited RAM issue.

Thanks,

Alexandre

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.