Skip to content

Migration Example 2 - FAT16

  • Level of Difficulty: Medium
  • Source IDE: MikroC PRO for ARM
  • Destination IDE: NECTO Studio
  • Project Name: MMC Fat16
  • Project Path: \path\to\IDE\MikroCforARM\Examples\ST\Development Systems\EasyMx PRO v7 for STM32 ARM\MMC\MMC Fat16\MMC_Fat16_Test.mcpar
  • Hardware Requirements: EasyMX PRO v7 for STM32 Development board with STM23F107VC

Let's Begin!

Step 1: Project Analysis

  • Open "MikroC PRO for ARM" IDE.
  • Open the "MMC Fat16" project and analyze project comments, code, dependencies, and settings.
  • Comments section analysis:

    • First comment worth analyzing is the "Description".

      • File operations will be performed: creating, opening, modifying and finally deleting of a file.
      • For this action SPI protocol shall be utilized.
      • UART protocol shall be utilized as well, for displaying all the data that is being written to a file.
    • Second comment worth analyzing is the "Test Configuration".

      • Microcontroller: STM23F107VC (STMicroelectronics)
      • Development Board: EasyMX PRO v7 for STM32 (MIKROE)
      • Clock Speed: 72MHz
    • Code Section Analysis:

      • Already from the start there is one header file which is being included (#include <__Lib_Mmc.h>).
      • As already mentioned, UART protocol shall be utilized.
      • Library for accessing data on MMC (Multi Media Card) and SD memory cards is being used as well.
      • In order to get file size, "Conversion" and "String" libraries are needed as well.
    • Library Dependencies:

      • This project needs libraries that had just been mentioned: so "Conversions", "C_String", "C_Type", "MultiMediaCard", "SPI" and "UART".
    • Project Settings:

      • Open up the "Project Settings" by clicking on the "Project" menu, then "Edit Project..." action item.
      • Internal oscillator is being used, 8MHz to be precise, and we got it ramped up to 72MHz with the help of the PLL functionality.

Step 2: Backup the Project

  • Ensure project backup for safety, copying the entire folder to a separate disk partition.

Step 3: Copy the Project Path

  • Utilize TOTAL COMMANDER and its shortcut "SHIFT+F6" to copy the project path.

Step 4: Open NECTO Studio

  • Launch "NECTO Studio".

Step 5: Select "Open"

  • Navigate to the "OPEN PROJECT" action button on the left side of the navigation bar in NECTO Studio.

Step 6: Paste the Project Path

  • Paste the project path in the "file name" section and hit "Enter" to update the main project window.

Step 7: Select the Project

  • Choose the project to migrate from the main project window and click "Open".

Step 8: Configure Setup

NECTO Studio's "Setups" wizard steps (FOR THIS PARTICULAR MIGRATION EXAMPLE).

  • Select a Compiler:

    • Click on the "New" action button on the upper-right corner of the "NECTO Studio" in order for embedded software developers to create their first setup.
    • Search and click on the "MikroC AI for ARM" compiler.
    • Open up "advanced compiler options" pop-up window by click on the "Advanced" action button in the lower central part of the window which empasizes the "MikroC AI for ARM" compiler.
    • Focus on the "Choose SDK version:" property section of the "advanced compiler options" pop-up window.
    • Make sure to select "mikroC for ARM Legacy 6.2.0" as a preferred SDK version.
    • Click "Save" in the upper right corner of the "NECTO Studio".
    • Click "Next" in the upper right corner of the "NECTO Studio".
  • Select a Development Board:

    • Search and click on the "EasyMX PRO v7 for STM32" development board.
    • Click "Next" in the upper right corner of the "NECTO Studio".
  • Select an MCU (Microcontroller Unit):

    • Make sure "EasyMX PRO v7 for STM32 MCUcard with STM32F107VCT6" microcontroller stays in the selected mode.
      • NOTE:
      • 72MHz is the default Clock speed in "NECTO Studio" for this particular microcontroller.
      • By clicking on "Advanced" action button, embedded software developers can modify the clock speed.
    • Click "Next" in the upper right corner of the "NECTO Studio".
  • Select a Display (if applicable to the project):

    • Make sure USB-B cable is connected to the "EasyMX PRO v7 for STM32" development board.
    • Make sure "Power" switch is turned ON in the "Power supply" on the "EasyMX PRO v7 for STM32" development board.
    • Skip the selection of a display by clicking "Next" in the upper right corner of the "NECTO Studio".
  • Select a Programmer/Debugger Device:

    • Select "mikroPROG for STM32".
    • Click "Finish" to finish the setup configuration;
  • Finishing Setup's wizard:

    • Rename the newly created configuration setup.
    • Make sure the newly created configuration setup stays in the selected mode.
    • Click "Choose" in the upper right corner of the "NECTO Studio".

Step 9: Test Project Functionality

Conduct a final test post-setup configuration.

If the Build action reports no issues, proceed to the next step.

  • STEPS FOR THIS PARTICULAR MIGRATION EXAMPLE:

    • Once configuration of the setup of the project had been configured, now it is the time for the final test of the project migration: has it been successful, or has it failed?
    • By clicking on the "Build" action button on the left sidebar navigation menu of the "NECTO Studio", and watching the "Issues" window in the lower part of the "NECTO Studio", and concluding there are issues with the project, embedded software developers are being presented with the project migration issue.
    • So, import was not a success. Importing of this project had been a fail. Nothing to be scared about, seriously!
    • Let's try to fix this issue!
    • Let's focus on the "Issues" window. The second line says "CMake error". The pop-up windows shows up and it informs the embedded software developer with more details about the problem. What we personally like to do in this situation is to go to "Compile Output" window and analyze the issue from there. We will just type in "cmake error" in the "search box", and we can observe the route to this "UART" library does not exist. Does it mean this "UART" library does not exist in NECTO Studio? Apsolutely not! "UART" library for this microcontroller exists and there are "UART" modules 0, 1, and 2 at your disposal in NECTO Studio as well!
    • Now, because this is a "CMake" error, we will focus on "CMake" project file, "CMakelists.txt" file. We will search for the "broken link", sorth of speak, or "UART012", and we will remove it from the "CMakelists.txt" file. That is the first thing that has to be done! The second thing that has to be done is making sure "UART" library is listed for this project, because, as you remember, this project expects that "UART" module is enabled in order to be able to see all the characters being written to a file on the SD card via "NECTO Studio"'s "UART" terminal tool. So we will make sure "UART" library is listed in the "CMakelists.txt" file by searching for it, and yes, there is "UART" library present in the library. It had been automatically included during the import of the project! Now, perform right click on the project, then select "parse project" action item. As a result, parsing a project had been a success!
    • Now click on the "Build" action button on the left side in the navigation bar of the "NECTO Studio"; another fail!
    • This is a linker issue. Linker cannot find a definition for the "SPI3_Init_Advanced" functionality. This can happen if we forgot to link a necessary library. Because "SPI" functionality is giving us troubles at the moment, let's lookup whether "SPI" library is linked or not inside "Cmakelists.txt" file; it seems SPI library is linked! Let's look at the "Library Manager" feature on the right hand side of the "NECTO Studio". If we search for the "SPI" library, it seems this library is not installed! Our conclusion is that "Cmakelists.txt" file is giving us a false positive state.
    • We will provide an instant solution right now, and that we will elaborate in details why this happened!
    • Instant solution would be to just check the "SPI" library in the "Library Manager"! After checking the "SPI " library, and by click on "Build" action button on the left side in the navigation bar of the "NECTO Studio", the result of building a project was a success!
    • You have successfully migrated your "MMC Fat16" project from "mikroC PRO for ARM" development environment into "NECTO Studio"!
    • Now, Let's see how this issue happened, to make it perfectly clear, because there is a possiblity some similar scenario could happen to you, so we want to make it perfectly clear.
    • We will undo the installation of the SPI library by unchecking the box! As we can conclude, there is our false positive "SPI" library linked over here! It is being called two times in this "Cmakelists.txt" file, two times only! Now, if we go back to the "Library Manager" and select the "SPI" library to be properly intalled, we will get one interesting thing over here in the "Cmakelists.txt" file... Try searching (CTRL+F)"SPI" keyword * four possible matches found? But, can you spot the difference between those? Letters, small and capital letters are the difference! This is the issue! What is the cause? Well, "SPI" stands for "Serial Peripheral Interface"! That is an abbreviation! So gramatically speaking, those three letters had to be written with capital letters. So, we changed the name of the SPI library! From "MikroC.Spi" to "MikroC.SPI"!
    • An embedded software developer could ask him self: "How this happened? How should I now what are the updated names of legacy "MikroC" libraries inside NECTO?"
    • Here is the answer! If you get this kind of errors, just perform the following tasks:
      • Find the installation location of the "NECTO Studio".
      • Enter the following path: "\NECTO Studio\sdk\legacy\v6.2.0\bin\STM\ST M3__Lib_SPI_123"
      • The last version of the "MikroC pro for ARM" IDE is the 6.2.0, and this is the reason why we are entering the folder with this exact name. If we go back to NECTO Studio, SPI3 module had been used for the communication with the SD card. So it seems to us that the folder that we have enter has "__Lib_SPI_123" folder name... But let's perform the double check. Let's get back to the "MikroC for ARM" IDE, open up "Library Manager" on the right side of the IDE, and expand "SPI" library. We are able to conclude SPI library for this particular microcontroller has three SPI modules (SPI1, SPI2, SPI3) so this means we can enter into folder with the following name: "__Lib_SPI_123"!
      • After entering the "__Lib_SPI_123" folder, we've been presented with "MikroC.SPI.memake" file, with the capital letters!
      • Just to make sure, we will jump into this ".memake" file, which tells me the "STM32F107VC" MCU, the MCU for this particular "MMC Fat16" project utilizes "MikroC.SPI", with capital letters, as a default "SPI" library module!
    • And why this happened? Why do we some libraries have small letters in their name in the "MikroC PRO for ARM" IDE?
    • If we focus on the "MMC_Fat16_Test.mcpar" file and we open this file in any kind of a text editor (VSCode for example), you will be able to witness the fact that "SPI" library is written with small letters by our software developers 15 years ago! This was the ultimate cause of the issue.

Step 10: Program the Microcontroller

By resolving the compilation and linker issues in the previous step, and by selecting the "Flash" action button on the left sidebar navigation menu of the "NECTO Studio", with the final goal of programming the microcontroller, embedded software developers are able to program the code in the microcontroller.

If the microcontroller is performing as it was performing while the project was in the "MikroC PRO for ARM" IDE, congratulations, because you have successfully migrated your project from "MikroC PRO for ARM" IDE into "NECTO Studio"!

This migration exemplifies a a more complex transition. The project exhibited scenario which had combination of embedded libraries and Cmake error to be resolved.

By following these steps, you can effectively migrate your projects from "MikroC PRO" to "NECTO Studio" and take advantage of its advanced features and capabilities for embedded software development.