Giter VIP home page Giter VIP logo

openrisc / newlib Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 24.0 114.02 MB

newlib OpenRISC development

License: GNU General Public License v2.0

Makefile 11.12% Shell 0.76% Emacs Lisp 0.04% Perl 0.29% C 71.53% C++ 9.52% Assembly 4.42% TeX 0.80% XSLT 0.01% Tcl 0.01% Batchfile 0.01% DIGITAL Command Language 0.01% Mathematica 0.01% M4 1.01% Scala 0.02% GDB 0.01% Python 0.10% Roff 0.19% CSS 0.01% Raku 0.16%

newlib's People

Contributors

aadit0402 avatar amylaar avatar bonzini avatar brianinglis avatar cagney avatar davek-cygwin avatar djdelorierh avatar ebblake avatar fitzsim avatar gingold-adacore avatar github-cygwin avatar haubi avatar hjl-tools avatar hpataxisdotcom avatar jakubjelinek avatar jjohnstn avatar joelsherrill avatar jon-turney avatar joshuadfranklin avatar jsm28 avatar kbrow1i avatar mgeisert avatar nickclifton avatar rbtcollins avatar rsandifo avatar sebhub avatar thomasp-66 avatar tyan0 avatar vapier avatar yselkowitz 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

Watchers

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

newlib's Issues

Question for or1k_timer_set_mode in or1k-support.h

hi, Dear expert:

I follow the steps in https://openrisc.io/newlib/building.html to build my own or1k toolchains.
Now I am trying to use timerrelated functions in $OR1K_ELF/or1k-elf/include/or1k-support.h.

I first start with the example at line 446 in or1k-support.h

void tick_handler(void) {
// Make schedule decision
// and set new thread
or1k_timer_reset();
// End of exception, new thread will run
}
int main() {
// Configure operating system and start threads..
// Configure timer
or1k_timer_init(50);
or1k_timer_set_handler(&tick_handler);
or1k_timer_set_mode(SPR_TTMR_SR);
or1k_timer_enable();
// Schedule first thread and die..
}

But the example failed to pass compile because the define SPR_TTMR_SR is missed.
I try to get the answer from the define of or1k_timer_set_mode.
/*!

  • Set timer mode
  • The timer has different modes (see architecture manual). The default is to
  • automatically restart counting (SPR_TTMR_RT), others are single run
  • (SPR_TTMR_SR) and continuous run (SPR_TTMR_CR).
  • \param mode a valid mode (use definitions from spr-defs.h as it is important
  • that those are also at the correct position in the bit field!)
    */
    void or1k_timer_set_mode(uint32_t mode);

But I still not clear about the value of mode for simple run and continues run.

Please kindly help.

Thanks.

what does it indicate whether it says its installed or is this an error?

i did ./configure and make then make install its showing like this...>
make[1]: Entering directory '/home/mahadev/or1k/newlib'
/bin/bash ./mkinstalldirs /usr/local /usr/local
make[2]: Entering directory '/home/mahadev/or1k/newlib/etc'
make[2]: Nothing to be done for 'install'.
make[2]: Leaving directory '/home/mahadev/or1k/newlib/etc'
make[1]: Nothing to be done for 'install-target'.
make[1]: Leaving directory '/home/mahadev/or1k/newlib'

Question about the period of timer.

hi, Dear expert:
I am trying to use timer interrupt.
So first I need to set the timer period.
There are two functions for this purpose.
int or1k_timer_init (unsigned int hz) 
void or1k_timer_set_period (uint32_t hz)
My question is why this function does not need the input of clock cycles?
if my clock freq is 100Mhz, I think the value should different to clock freq 50Hz.

Thanks.

void or1k_interrupt_enable(int line) does not work

hi, Dear experts:

I am trying to use void or1k_interrupt_enable(int line) to enable just one interrupt.
But it does not work.
I have to use void or1k_interrupts_enable(void) to enable all interrupts.

Looking forward to your reply.

Thanks.

or1k timer and interrupt can be enabled at same time?

hi, Dear experts:

I tried to enable timer and interrupt at same time.
I add print in timer tick handler function. If I just enable the timer, I can see the print message.
But if I add or1k_interrupts_enable(); then the print message will not seen.

So is there any examples which support timer and interrupt at the same time?

Thanks.

Pointers are not processed correctly when stored in global structure

Hi,

Following issue occurs on a mor1kx but I think it may be a toolchain problem.

When defining a byte array and casting parts of the byte array to a DWORD, the address of the first byte of the DWORD is probably not DWORD aligned (i.e. &byte_array[1] = 0x00000001 ). Normally, this is no problem and the DWORD pointer can be dereferenced correctly (i.e. p_u32 = (uint32_t *)&byte_array[1]; a=*p_u32;). When storing the DWORD pointer in a global structure, this does not work, the program simply hangs up when trying to dereference the pointer stored in the global struct. Please find below a program to show the problem. The program works fine compiled with standard gcc on a Linux machine but hangs up in Modelsim simulation when compiled with or1k-elf-gcc.

I am not sure to which branch of Openrisc development it belongs but it may be a toolchain problem as the dereferencing in general works when using the local struct. Also I am not sure if this is already fixed as I use an older (~1 year) version of mor1kx and toolchain.

Best regards,
Markus

#include <stdint.h>
#include <stdio.h>
  
//the structure contains a byte pointer and a DWORD pointer
typedef struct
{
  uint8_t  * p_struct_u8;
  uint32_t * p_struct_u32;
} struct_pointers;
  
//the structure itself as global variable; does not work!
struct_pointers sp;       //comment this line and uncomment the local struct definition to work correctly

int main(int argc, char *argv[])
{
  //10 byte array
  uint8_t v_array_u8 [10] = {1,2,3,4,5,6,7,8,9,10};
  
  //pointer to byte
  uint8_t * p_u8;
  //pointer to DWORD
  uint32_t * p_u32;

  // struct_pointers sp;  //the structure as local variable does work; uncomment this line and comment the global struct definition to work correctly

  //point to first byte (DWORD aligned pointer address)
  p_u8  = &v_array_u8[0];
  p_u32 = (uint32_t *)&v_array_u8[0];
  
  //store the pointers in the struct
  sp.p_struct_u8  = p_u8;
  sp.p_struct_u32 = p_u32;
      
  printf("Addresses of pointers without struct DWORD aligned \n\r");
  printf("p8:   %#010x \n\r", (unsigned int)p_u8);
  printf("p32:  %#010x \n\r", (unsigned int)p_u32);
  printf("Dereferenced pointers without struct \n\r");
  printf("*p8:  %#010x \n\r", (unsigned int)*p_u8);
  printf("*p32: %#010x \n\r", (unsigned int)*p_u32);
  
  printf("Addresses of pointers stored in struct DWORD aligned\n\r");
  printf("sp8:   %#010x \n\r", (unsigned int)sp.p_struct_u8);
  printf("sp32:  %#010x \n\r", (unsigned int)sp.p_struct_u32);
  printf("Dereferenced pointers from struct \n\r");
  printf("*sp8:  %#010x \n\r", (unsigned int)*sp.p_struct_u8);
  printf("*sp32: %#010x \n\r", (unsigned int)*sp.p_struct_u32);
  
  
  //point to second byte (not DWORD aligned pointer address)
  p_u8  = &v_array_u8[1];
  p_u32 = (uint32_t *)&v_array_u8[1];
  
  //store the pointers in the struct
  sp.p_struct_u8  = p_u8;
  sp.p_struct_u32 = p_u32;
    
  printf("Addresses of pointers without struct not DWORD aligned \n\r");
  printf("p8:   %#010x \n\r", (unsigned int)p_u8);
  printf("p32:  %#010x \n\r", (unsigned int)p_u32);
  printf("Dereferenced pointers without struct \n\r");
  printf("*p8:  %#010x \n\r", (unsigned int)*p_u8);
  printf("*p32: %#010x \n\r", (unsigned int)*p_u32);
  
  printf("Addresses of pointers stored in struct not DWORD aligned\n\r");
  printf("sp8:   %#010x \n\r", (unsigned int)sp.p_struct_u8);
  printf("sp32:  %#010x \n\r", (unsigned int)sp.p_struct_u32);
  printf("Dereferenced pointers from struct \n\r");
  printf("*sp8:  %#010x \n\r", (unsigned int)*sp.p_struct_u8);
  printf("*sp32: %#010x \n\r", (unsigned int)*sp.p_struct_u32);   //hangs up here when dereferencing non DWORD aligned address
  
  printf("Successfully finished! \n\r");
  
  while(1) {};
}

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.