This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

placing/accessing constants inside flash memory

Subject says it all. I want to place some tag into flash and than compare it with the data in my SRAM. I know that it is simple but it is hard to start. Please advise. Thanks.

Parents Reply Children
  • I have an old version of this RTX_Blinky. I did some tests.

    Modified Blinky.c =>

    /*----------------------------------------------------------------------------
     *        Task 6 'lcd': LCD Control task
     *---------------------------------------------------------------------------*/
    __task void lcd (void) {
    
      const unsigned char hello[] = "Hello";
      for (;;) {
        os_mut_wait(mut_GLCD, 0xffff);
        GLCD_SetBackColor(Blue);                           /* Set the Text Color */
        GLCD_SetTextColor(White);                          /* Set the Text Color */
        GLCD_DisplayString(0, 0, "  MCB1700 RL-ARM    ");
        GLCD_DisplayString(1, 0, "    RTX Blinky      ");
        GLCD_DisplayString(2, 0, "   http://www.keil.com     ");
        GLCD_DisplayString(2, 0, hello);
        os_mut_release(mut_GLCD);
        os_dly_wait (400);
    
        os_mut_wait(mut_GLCD, 0xffff);
        GLCD_SetBackColor(Blue);                           /* Set the Text Color */
        GLCD_SetTextColor(Red);                            /* Set the Text Color */
        GLCD_DisplayString(0, 0, "  MCB1700 RL-ARM    ");
        GLCD_DisplayString(1, 0, "    RTX Blinky      ");
        GLCD_DisplayString(2, 0, "   http://www.keil.com     ");
        os_mut_release(mut_GLCD);
        os_dly_wait (400);
      }
    }
    

    KEIL toolchain says:
    -> Blinky.c(142): error: #167: argument of type "const unsigned char *" is incompatible with -> parameter of type "unsigned char *"

    Modified Blinky.c, added a casting =>

    __task void lcd (void) {
    
      const unsigned char hello[] = "Hello";
      for (;;) {
        os_mut_wait(mut_GLCD, 0xffff);
        GLCD_SetBackColor(Blue);                           /* Set the Text Color */
        GLCD_SetTextColor(White);                          /* Set the Text Color */
        GLCD_DisplayString(0, 0, "  MCB1700 RL-ARM    ");
        GLCD_DisplayString(1, 0, "    RTX Blinky      ");
        GLCD_DisplayString(2, 0, "   http://www.keil.com     ");
        GLCD_DisplayString(2, 0, (unsigned char *)hello);
        os_mut_release(mut_GLCD);
        os_dly_wait (400);
    

    KEIL toolchain says:
    -> ".\Obj\Blinky.axf" - 0 Error(s), 0 Warning(s).

    --
    I have learnt a lot from Per Westermark's articles. His articles are very detailed and well organized. I can understand that, some people just don't like/need so much details. But, to me, those are very valuable information. I would like to take this opportunity to thank Per Westermark again.

  • If one would ask: “What is the weather forecast for today?" And another one would provide extended "answer" including historical data and definitions of units and bunch of other very helpful and useful information; I won't consider this imaginary conversation as a question and answer. When the question about the weather has been asked the other person should probably at least ask: “Weather where?" Without this tiny detail the OP question could not be answered. That is actually all my point.
    Thank you for listening :)