[SOLVED] The variables are not updated when the program is running

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] The variables are not updated when the program is running

    In KEIL (5.23), a simple program is generated. Then the project was imported into SES (3.28a). The program is compiled and run in debug mode, one variable is output to the output window (watch1).
    Two pictures.
    First, the program is stopped (stp.png)
    The data is displayed normally. If you start and then stop, then the data will be normal.
    If the program is run, then - see the second picture (run.png)
    Data is not output. An error message appears.



    Similar problems occur in other windows (eg memory). If the program is stopped, the correct value is displayed. If the program is running, the data is not changed.

    If you switch the output mode (never / every second ...) - nothing changes, at runtime the variables do not change.
    Images
    • stp.png

      45.54 kB, 859×482, viewed 1,698 times
    • run.png

      37.71 kB, 974×447, viewed 1,275 times
    Files
    • TST2.zip

      (362.58 kB, downloaded 483 times, last: )
  • Hello,

    Thank you for your inquiry.

    What target device are you trying to program?
    What J-Link are you using and what is its serial number?
    Could you debug the project in Keil?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello.
    Processor STM32F103 and STM32F303. The defect is the same.
    The JLink-STlink debugger is described in more detail in my previous topic. However, this is not so important. I took the JLink-OB for a while, the defect completely repeated. To get a defect, set the output of the variables "Twice a Second", or any "*** Second".
    There are no problems in KEIL. Absolutely no problems.
  • Hello,

    Processor STM32F103 and STM32F303. The defect is the same.


    In your Embedded Studio project you are using a STM32F100C8 which is neither of the two target devices you mentioned.
    Make sure to set the correct target device in the project settings, otherwise basic features might already not work.
    Does that solve your issue?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • рукалицо

    Hello.
    I made a clean project in KEIL with the native devices of the debug board (MCU STM32F030).
    The variable is shown in the "Watch1" window and as a memory in the "Memory1" window.
    If the program is stopped, the correct value is displayed in the two windows. If the program is started and stopped, the new value of the variable is displayed correctly in both windows (Watch1 and Memory1).
    If the program is running, the values ​​in the Memory1 window change, and in the Watch1 window the data does not change, an error is output.
    Please note that your SES program reports that the variable does not have an address. Exactly the same results as in the first message of the topic.

    If there is any doubt, I can make a video. Specify the address where to send it.
  • Hello,

    EDIT: We could reproduce the issue with the code you are using.
    The problem is that you are declaring only a local variable. That way the variable will only be passed between stack and registers.
    make sure to declare it static outside of the main function and you will be able to see live updates of the variable in the watch window.

    e.g.

    C Source Code

    1. static int TmpCnt;
    2. int main(void) {
    3. while (1)
    4. {
    5. ;
    6. TmpCnt++;
    7. TmpCnt++;
    8. TmpCnt++;
    9. }// while 1
    10. }
    Display All


    What target board are you using?
    You seem to be changing your setup each time you post. Please be consistent so i can try to reproduce the issues you are seeing.
    I tried to recreate the issue with a NUCLEO-F103RB Eval Board. But the memory window, watch window and everything else was updating just fine.
    Could you try to create a clean Embedded Studio Project using the Package Manager?
    How to create new projects in ES is described here: segger.com/products/developmen…ology/project-management/
    More information about CPU support packages can be found here: segger.com/products/developmen…o/technology/cpu-support/

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello,

    you did not adjust your source code.
    Please try the following:

    EDIT: We could reproduce the issue with the code you are using.
    The problem is that you are declaring only a local variable. That way the variable will only be passed between stack and registers.
    make sure to declare it static outside of the main function and you will be able to see live updates of the variable in the watch window.

    e.g.

    C Source Code

    1. static int TmpCnt;
    2. int main(void) {
    3. while (1)
    4. {
    5. ;
    6. TmpCnt++;
    7. TmpCnt++;
    8. TmpCnt++;
    9. }// while 1
    10. }
    Display All




    Does that solve your issue?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello,

    I am glad to hear it is working as expected now.
    Unfortunately, the project is compiled once, on the second compilation solution there is an error.


    As the error states the LinkerScript could not be found.
    In your case it was inside ./Objects/f303a.sct and is generated by Keil MDK. If you now do a rebuild all temporary files and folders will be deleted and rebuild.
    Unfortunately the LinkerScript can only be rebuild by Keil directly and not through Embedded Studio.

    To avoid this happening each time you rebuild simply copy the f303a.sct to your main project directory.
    Now change the project settings under Linker->Linker Script File to f303a.sct

    When you do a rebuild now the LinkerScript is kept and all other Object files can be rebuild.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello Nino.
    Once again - thank you for your help.
    Excuse me, can I be straight (honestly)? KEIL works correctly with its settings. SES correctly build on the settings that are imported. But, SES can not make a rebuild (solution).

    The file sct already exists, is present in the Objects directory.
    In order to eliminate the error, you must:

    a) go to KEIL on the linker tab, remove the checkbox from "Use Memory Layout ..";
    b) click "Edit";
    c) close the unnecessary scatter file window.
    After that, you will have to re-import the project. SES for some reason can not read the current settings.

    "To avoid this happening each time you rebuild simply copy the f303a.sct to your main project directory."

    And do you know what it will lead to? KEIL (5.23) ignores the other location of the sct file and always recreates the sct file (when changing the processor) only in the Objects directory.
    So, the project is compiled ... no matter how. Now here:

    The post was edited 1 time, last by u37 ().

  • Hello,

    Yes the error was reproducible on our side (this is now another error then before). According to Keil support this is related due to a missing startup file for your device.
    Keil links most CMSIS files from its install directory, thus they are missing when porting from Keil to Embedded Studio.

    The Embedded Studio project importer only offers basic porting capabilities and will only copy the local project structure.
    More complex projects where multiple files are linked from other directories than the local project directory will not be moved to the Embedded Studio project. This has to be done manually by the user.

    May i ask why you are trying to move generic CMSIS projects from Keil to ES?
    You can create this projects directly from ES as we offer CPU support packages that are based on the same CMSIS files that Keil is using.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thank you for your help!
    The point is that in KEIL there is a representation of the periphery in debug mode. Different people use ARM differently. Someone makes "windows" with a nice GUI, and I use processors to solve simple hardware problems. For example, the previous project was in the hardware filter to smooth the movement of the CNC (processor f030). Now we need to make a motor controller. All these are "hardware" devices. They require a clear and reliable operation of the equipment (periphery) with the categorical exception of overlapping and omissions. This means a clear control of the hardware during debugging. For this, I take the necessary variables to "watch" and observe the operation of the device. But, to monitor the periphery, it is required to look at the work of this very periphery. Moreover, one can not say in advance what will be required at any particular moment. In KEIL simply - went and turned on the display of the necessary equipment. There you can change this equipment. Is it often necessary? It is rather rare, but when it is necessary, it can not be done without, in any way.
    That's why KEIL.
    Tried still VisualGDB - very interesting project, rather advanced IDE (in comparison with KEIL). The peripheral display has, but it only works in the stopped mode. The second drawback - the program is paid. I do not need to write large code, not the tasks, so there is no conflict with KEIL.
    Here I tried SES and so far I see that I can not refuse from KEIL. Although I clearly understand that IDE in KEIL is simply awful.
    So here it is.
  • Hello,

    Thank you for the additional information.

    If i understand you right you want to be able to edit and monitor the MCU's SFR registers through a window like i Keil.
    This is already possible. In ES under View->Registers you can open a Register watch window.
    If you have selected a register description file (e.g. .svd file) for your device you will be able to select multiple registers to show and edit directly.

    Per default only CPU registers are shown. To show other registers as well click on Groups in the Registers window and enable the SFRs that you want to monitor or edit.

    Attached are two pictures that show this feature for a generic STM32407 device generated with the packages from the package manager.

    Best regards,
    Nino
    Images
    • Capture.PNG

      45.86 kB, 892×623, viewed 746 times
    • Capture1.PNG

      18.72 kB, 439×402, viewed 763 times
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thank you for your help!
    In the project settings, "none" is specified in the description of the register file (svd). If there is a reference to .svd, the peripheral registers will appear.
    The registers description file (STM32F302x.svd) is specified in the KEIL project settings (<SFDFile> $$ Device: STM32F302C8 $ SVD \ STM32F302x.svd </ SFDFile>). The location of the SVD catalog is also described (<PackID> Keil.STM32F3xx_DFP.1.4.0 </ PackID>). Do I need to enter it with my hands?
    But that's not all.
    I open registers - all-all-all in one small window. Horror. In KEIL for each peripheral device has its own bookmark. In SES - one bookmark and it should be rewound for a long time.
    All? And this is not the end. The data itself is not updated. To do this, click the "refresh" button.
    Tell me, Nino, why do not you love me so much? This is a continuous torment.
    I really want to use SES, but for now I have to be treated for a nervous tic. ((
  • Hello,

    In the project settings, "none" is specified in the description of the register file (svd). If there is a reference to .svd, the peripheral registers will appear.

    Correct.

    The registers description file (STM32F302x.svd) is specified in the KEIL project settings (<SFDFile> $$ Device: STM32F302C8 $ SVD \ STM32F302x.svd </ SFDFile>). The location of the SVD catalog is also described (<PackID> Keil.STM32F3xx_DFP.1.4.0 </ PackID>). Do I need to enter it with my hands?


    You will not be able to use path macros that are defined in Keil. To set the path you can type them in by hand either relative to the project directory or absolute.
    Alternatively simply use the browse function of the projects menu. Attached are two pictures that show the browse button for the register file option.

    I open registers - all-all-all in one small window. Horror. In KEIL for each peripheral device has its own bookmark. In SES - one bookmark and it should be rewound for a long time.
    All? And this is not the end. The data itself is not updated. To do this, click the "refresh" button.


    You can open up to 4 separate register windows and move them around freely... so i really don't understand what your problem is here...you can also collapse each register group for easier sorting.
    The window is not refreshed constantly, correct. For that simply use the watch feature as discussed before where you can enter different expressions to filter out the registers you want to monitor.

    Could you please provide us with the serial number of your J-Link? Otherwise further support is not possible.

    Best regards,
    Nino
    Images
    • Capture.PNG

      44.23 kB, 1,284×654, viewed 745 times
    • Capture1.PNG

      18.49 kB, 1,284×654, viewed 707 times
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    great to hear that you are up and running again.
    I will consider this case as solved then.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.