Skip to the content of the web site.

Hints from former students

  • If you can, implement as much of the project in an IDE that you're familiar with. For example, the data structures for Projects 1 and 2 can be written entirely in Visual Studio or CodeBlocks (a free C IDE). Once you get these working there, you can then transfer them over to μVision.
  • Sometimes, code will work on the actual board but not on the simulator. It's often easier to just debug on the board itself.
  • The simulator begins with memory zeroed, but the actual board might not. If you forget to initialize your variables, this could lead to code working on the simulator but not the board.
  • You cannot declare more than 32 KiB of contiguous memory.
  • Don't forget to check Use MicroLIB if you are using dynamic memory allocation (malloc and free) or multitasking.
  • Sometimes projects won't load onto the board. Copy the files over into a new project and recompile to get it working.
  • When using the simulator, you will get error #65 where you can't write to certain memory locations; you will have to remap the memory in the debugger and allow write access to that address.
  • When the code runs for a few iterations but inexplicably fails (stops executing), this is usually an indication that the stack has been blown, or if you are using the heap, that the heap has run out of space. Increasing the stack or heap size should fix things. If you are using tasks, you can check for stack overflow by selecting the corresponding flag in the RTX configuration file.
  • Sometimes you will not be able to compile when your project is in the N:\ drive. You will get an error about missing .o files. As a workaround, copy your project to the C:\ drive, reopen it, and work from there. Just remember to copy it back to the N:\ drive when you're done to keep it safe (and delete the copy resident on the computer).
  • It is much easier to use the UART serial output for debugging print statements than it is to print to the LCD screen.
  • Tasks must be killed using os_tsk_delete or os_tsk_delete_self; to switch between tasks of the same priority, use os_tsk_pass. Never return from a task's entry function or the system will hang.
  • When trying to use the Keil board UART, sometimes you'll be able to see output on one device and not on another. If this is the case, it may be that you have to change your COM port on PuTTY (which corresponds to the computer port connected to the Keil board) or your PORT_NUM macro in Retarget.c (which corresponds to the Keil board port connected to the computer).
  • When
  • The μVision compiler will not catch fatal errors that are not directly syntax but will still cause a complete system crash. An example is trying to use task-related functions or a printf during an interrupt service routine. These are sometimes difficult to identify as the problem.
  • Sometimes one of the jumpers (blue) are missing from people taking them off. INTO and LED jumpers are required to use INT0 or the LEDs, respectively. There may be more instances of other required jumpers that are missing.
  • When authoring a new data structure, always start with a shell for each function, even if it does nothing (if it returns an int, have it return 0; if it returns a pointer, have it return NULL). The first project has this done for you, but in subsequent projects, the option to do this is left to you. Even if they are not done for you, do them yourself before you write any code what-so-ever.
  • The number of tasks in the Keil RTX is limited. By default, it is set to 7. Although, it can be modified there is still a limit since resources are limited. To increase the number of tasks to a value closer to the maximum of 250, the stack size must be decreased. Conversely, to increase the stack size closer to the maximum, the number of tasks must be decreased. This memory is based on the total board memory available, so if you decrease it in the startup file you can allocate more for your tasks.