- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all, I have started a course on Embedded system design using the nios II and a de-2 board. We are provided with the following code:
#include <sys/alt_irq.h> // for irq support function# include "system.h" // for SOPC defines
/*============================== Integer Types ===============================*/
typedef signed char sint8; // signed 8 bit values
typedef unsigned char uint8; // unsigned 8 bit values
typedef signed short sint16; // signed 16 bit values
typedef unsigned short uint16; // unsigned 16 bit values
typedef signed long sint32; // signed 32 bit values
typedef unsigned long uint32; // unsigned 32 bit values
typedef float real32; // 32 bit real values
//*****************************************************************************
// Define symbolic constants
//*****************************************************************************
//*****************************************************************************
// Define private data
//*****************************************************************************
int main(void)
{
// red_leds is a pointer to the R_LEDs
uint32 * redLedsPtr = (uint32 *) RED_LEDS_BASE;
// switches points to the switches
volatile uint32* switchesPtr = (uint32*) SWITCHES_BASE;
while(1)
{
// set the LEDR equal to SW
*(redLedsPtr) = *(switchesPtr);
} /* while */
return 0;
} /* main */
when run each switch turns on each corresponding led on the board. I then removed the volatile keyword and rebuilt the project, however it still runs perfectly on the board. I would have expected the compiler to basically optimize away the contents of the while loop. I have two questions, if no breakpoint is set in the code is there a difference between running it normally or in debug mode? Is there something I may be missing as far as getting the rebuilt program code loaded on to the board? I have been using quartus for the last year targeting the de-2 board for previous courses but this is my first time using the nios eclipse IDE. Any help would be appreciated, thanks.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, it turns out I had compiler optimizations turned off. Switched them on to level 2 and the program worked (failed actually) as expected. Are things like optimization settings specific to each project? Or is there a way to specify settings globally?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page