This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMDSLCDK6748: RTS library causing issue with EMIF?

Part Number: TMDSLCDK6748
Other Parts Discussed in Thread: OMAP-L138, SYSBIOS, OMAPL138, TMS320C6748

Tool/software: TI C/C++ Compiler

Hi everyone,

I'm having trouble reading from the NAND flash chip (MT29F4G16ABADAH4) on the LCDK board, and I'm looking for suggestions.

I send a basic READ ID command (0x90, 0x20), but instead of reading back the normal ONFI code (ascii "ONFI")  I get an ascii "OOOO". The memory browser actually shows "ONFI" but it seems that the data isn't being properly shifted out of the NAND cache register.

A few additional facts:

  • When I compile TI's NANDWriter_DSP project I do not have this problem - even if I add SYS/BIOS I can still flash a boot image just fine
  • I'm using some of the same code from TI's NANDWriter_DSP project in my project
  • I'm using compiler version TI v8.1.0
  • My project uses TI-RTOS. However, this issue occurs even before a call to BIOS_start()

Strangely, when I create a copy of the NANDWriter_DSP project with SYS/BIOS and try a READ ID command then it works just fine -- but when I use the same code in my SYS/BIOS project it compiles differently and does not shift properly (as described above). I've attached screenshots showing the difference in disassembly.

Code for reading from NAND flash: devID16[i] = *addr_flash;


I've searched the compiler settings of both projects looking for some difference that could account for this but I came up empty-handed. It feels like I'm missing something obvious.

Any help or insight on this would be immensely appreciated. I'm happy to provide additional information and clarification as needed.


Thank you,

David Askew

  • Hi David,

    I've notified the design team. their feedback will be posted here.

    Best Regards,
    Yordan
  • Much appreciated!

  • Hi Yordan,

    Just wanted to confirm that we are still seeing this problem. Has the design team been able to take a look? Again, I'm happy to provide additional information and context as needed.

    Best regards,

    David

  • Hi David,

    I've sent a reminder. I will post as soon as I have any feedback.

    Best Regards,
    Yordan
  • David,

    I don`t believe this is an issue with the compiler. Have you checked the EMIFA configuration registers? In CCS you can go to tView->Registers and compare the EMIF register settings. Are there any differences?
    Are you using the same driver as that used by the NAND Writer ? or are you using your own custom code.

    the NAND Writer uses the nand driver code provided in nand.c in the directory: OMAP-L138_FlashAndBootUtils_2_40\Common\drivers\src
    Look at the function NAND_open and LOCAL_flashGetDetails for how the NAND writer reads the ONFI string from the ID bytes.

    Regards,
    Rahul
  • Hi Rahul,

    Thank you very much for offering your assistance with this matter. I have made marginal progress since my last post, but I will answer your questions before getting into that.

    Have you checked the EMIFA configuration registers? Are there any differences?

    I have compared the EMIFA configuration registers and ensured that they are identical.

    Are you using the same driver as that used by the NAND Writer? Look at the function NAND_open and LOCAL_flashGetDetails for how the NAND writer reads the ONFI string from the ID bytes.

    In trying to debug this issue I have familiarized myself with the NAND Writer driver and its functions, including those you mention. I am using almost entirely the same code as the driver, and where it is not exactly the same it is functionally identical.

    I did stumble upon a way to "fix" the problem by adjusting the link order of the build, but that fix causes another problem. Let me explain:

    When I link "lrts64plus_elf.lib" before the "Generated Linker Command files" produced by (I assume) XDC for SYS/BIOS, then I do get the expected "ONFI" response shifted out of the NAND cache register. Success! ...Or so I thought.

    Unfortunately, this change also seems to disable TI-RTOS. Tasks fail to run and the system seems to idle and do nothing -- stuck in the SYS/BIOS function Task_allBlockedFunction(). I have attached a couple screenshots for clarity.

    When all the entries are removed from the Link Order list, the behavior is identical to the "OOOO" case (second screenshot).


    As I am unfamiliar with the inner workings of XDC and TI_RTOS, I must admit that I have very little clue as to what is happening here. Any thoughts or insight you can offer would be greatly appreciated.

    Thank you,

    David

  • David,

    Do you mind sharing the code by attaching your code to the response. I would like to reproduce this issue on my LCDK board and reply to you with the fix. Also, usually when using SYSBIOS, we don`t usually link in aa .cmd file as it can cause conflicts with the SYSBIOS platform definition but if you are not seeing any linker issues then the .cmd file memory sections may not be conflicting with the platform definition.

    Anyways, please post your project code here and I will try to get back to you after reproducing the issue.

    Regards,
    Rahul
  • Rahul,

    I excluded several sections from the platform and used my own linker command to define those sections. That really hasn't been an issue thus far.

    I have attached a stripped-down version of the project along with a couple additional resources you might need. In the current configuration, if you place a breakpoint on line 171 of nandwriter.c you will see the correct "ONFI" response in devID16[], but the clock module and semaphore will not execute. Try switching the link order of -lrts64plus_elf.lib and Generated Linker Command files, and you will find that the clock and semaphore works, but the DSP reads in "OOOO" for the ONFI response. (Removing all link order specifications result in the same behavior.)

    Please let me know if I can provide any clarification, or if you need any additional include files. I appreciate your help with this.

    Many thanks,

    David Askew

    1050.PDI_Core_NAND_Example.zip1526.PDI_Additional_Resources.zip

  • Attached is the custom platform I am using.

    -David

    1588.Platform_evm6748custom.zip

  • Unfortunately, I was not able to build this package as I seem to be missing many of the files and include paths that you have specified.
    I don`t have the file tistdtypes2.h. can you tell me where you got that file from.

    I am not sure what purpose the C6748.cmd file is serving in the project. If you see the generated linker command file linker.cmd under Debug/configPkg , all the relevant sections are being placed in DDR. ALso note RTOS is including the required RTS libraries in the linker command file, so you don`t need to explicitly link to the rts64xplus_elf.lib. If you still see the SSYBIOS hung at Task aLL blocked, you will need to single step to see what line of code is causing this issue.

    Regards,
    Rahul
  • If you provide me with a list of the files and include paths you require then I would be happy to upload them here.

    In addition to some other files you might be missing, I have attached the custom file ”tistdtypes2.h" which is essentially the standard "tistdtypes.h" with certain typedefs removed. This was a consequence of importing the NANDWriter drivers into a TI-RTOS project. I removed those specific typedefs because they were causing errors about "invalid redeclaration of type name". For example, the "Int8" typedef is defined as "char" in tistdtypes.h but also defined as "xdc_Int8" in \ti\xdctools_3_30_06_67_core\packages\xdc\std.h

    This brings me to the more general point, which is that I suspect this whole problem is a result of importing the NANDWriter drivers into a TI-RTOS project. (The NANDWriter_DSP project was not created within a TI-RTOS project). Importing was not a simple process as it required modifying a few files (such as tistdtypes2.h) in order to avoid compatibility issues resulting in compiler and linker errors.

    "Also note RTOS is including the required RTS libraries in the linker command file, so you don`t need to explicitly link to the rts64xplus_elf.lib"

    Yes, the auto-generated linker command file includes the library "ti.targets.rts6000.ae674", but not rts64xplus_elf.lib. As mentioned in my last post: When the explicit link to rts64xplus_elf.lib is removed, the response to READ ID commands become "OOOO" instead of "ONFI", and I am thus stuck with the original problem.

    To your knowledge, has anyone successfully implemented the NANDWriter drivers in a TI-RTOS project? A basic example project that demonstrates this task may be all I need to solve the issue. Is there some other NAND chip driver I should be using for TI-RTOS projects? Your advice and assistance are very much appreciated, as always.

    Thank you,

    David Askew

    8831.PDI_Additional_Files_tistdypes2.zip

  • Hi Rahul, have you had a chance to look into this yet?

    I tried single-stepping to find out what is causing SYS/BIOS to hang in Task_allBlockedFunction(). The infinite loop occurs at line 255 in Task.c:

    Void Task_startCore(UInt coreId)
    {
       //<omitted code>
        /* stall until a task is ready */
        while (Task_module->curSet == 0) {
            Task_allBlockedFunction();
        }
    
     //<omitted code>
    
    }

    I should reiterate that this problem occurs ONLY when explicitly linking rts64xplus_elf.lib before "Generated Linker Command files". Yet if I don't explicitly add rts64xplus_elf.lib (and link it first) then the reads from the NAND cache register fail to shift out properly, as I've described.


    My question really boils down to this:

    If the disassembly is identical in both cases, and the EMIFA control registers are also the exactly same in both cases, then how could the RTS libraries and their link order change the behavior of the NAND chip?

    This is the phenomenon that I am seeing. The RTS libraries linked by TI-RTOS are somehow causing dysfunction in the interface between the NAND device and the DSP. Has anyone successfully implemented the NANDWriter drivers in a TI-RTOS project?

    Thanks,

    David Askew

  • David,

    Rahul is the right expert and has the right tools to be looking at this for you, but I wanted to look at some things from a different point of view since you are still having trouble. Rahul knows the drivers much better, and I do not know them at all, so I cannot help from there.

    But there are two things I would like to discuss on this:

    1. Since linking things in a different order changes how the program behaves, that hints to a speed or L1/L2 cache problem. It would help to compare the linker's .map output file between the working linked version and the failing linked version to see which code modules have moved especially if they are relevant to this particular operation, both in data and program space. There could be errors in the linker command file, meaning the definition of memory, so that some things get put where they should not be or get moved to cached from non-cached, and so on. Finding what the differences are will be telling and could point to more things to look at.

    2. Even though the assembly code you showed in the first post looked identical, the working version uses a very large Stack Pointer offset plus it uses a register offset for the STH instruction because the span was so long; the failing version uses a much smaller SP offset and a constant 16 for the STH instruction's offset. This tells me it could be useful to find out exactly what is happening differently in the two versions. The way to find out is to run to the top of that loop and single-step-assembly through it looking at (and recording) each register change as it occurs, then do the same in the other version and compare the active registers. It is convenient that the code is so close to identical so the registers are mostly going to behave the same - the assignment to B6 is missing for the working version so its value will be interesting to know to see what it is trying to reach.

    Regards,
    RandyP
  • RandyP,

    Thank you so much for your thoughtful advice. One thing I was not clear about in the last post was that I am encountering this problem even with disassembly that is literally identical, from the same project but with a different link order. So perhaps we can knock #2 off the list. (The original post was assembly from two different but similar projects – one of which does define a very large stack size. This was before I realized that link order was the determining factor.)

    As for #1, I'm hopeful that this might lead to the source of the issue. Comparing the .map files of both versions, i.e. same project with different link orders, it's clear there are quite a few differences. Although I am still looking into it, I thought it best to provide this status update. I have also attached the two .map files for reference (renamed as .txt files in order to upload them)

    I do wonder if the cached/non-cached thing is what is causing issues when writing to and reading from the NAND memory. However I'm not sure what the best way to test for this might be.

    Thanks again for your assistance and insight. There are definitely some leads to follow now!

    Best regards,
    David Askew

    NAND_Broken__RTOS_Working.txt   NAND_Working__RTOS_Dead.txt 

  • David,

    #2 is more important knowing that the identical assembly will behave differently. I am assuming that this loop is the exact place where the read is occuring that gives you ONFI or OOOO for the passing and failing cases, respectively. If you can step through it and write out the register values for each line, it will make investigating the .map file more fruitful and has the best chance to get to an answer. What I would like to see (easy for me to say) is:

    c0046a20: 02804AEF LDW.D2T2 *+B15[74],B5 B15=0x???????? B5=????????

    and the same for all of the lines all 4 times through the loop, showing the registers used in each instruction. B5 in this case is a don't care until 4 cycles later, but it would be good to show for completeness.

    The values of pointer registers will help understand where to look in the .map, and all the values may show up a problem that is causing the problem itself. I am assuming that addr_flash is a pointer to the EMIF address range.

    What compiler switches are you using? You can get those from CCS properties box for Build -> Compiler. All the NOPs and LDW/STW pairs imply no optimization but the code is pretty serial in nature so I am curious about the settings. No optimization is good for debug, for sure, and maybe it can get improved once this problem is worked out.

    Regards,
    RandyP
  • RandyP,

    That makes sense. I'll follow your advice and step through that loop, paying special attention to the values of those pointer registers. Once everything is nice and debugged I definitely intend to use code optimization. The switches I am using are:

    -mv6740
    --abi=eabi -Ooff
    --advice:performance=all -g
    --define=omapl138
    --define=c6748
    --diag_warning=225
    --diag_wrap=off
    --diag_suppress=824
    --display_error_number
    --gen_func_subsections=off
    --mem_model:const=data
    --wchar_t=16
    --mem_model:data=far_aggregates

    Thanks,
    David
  • RandyP,

    I stepped through that loop in both versions and recorded the values of relevant registers. I found that the only real difference was the value being read in from the NAND cache register. I have attached an excel sheet that shows the recorded values.

    In the working version you can see where the NAND cache register (0x62000000) shifts out the next 16 bits of data after a read operation. In the non-working version the shift never happens; the memory browser can see 'O' at 0x62000000 and 'N' at 0x62000002, etc., but because the register doesn't shift, the NANDWriter driver just reads a string of 'O's instead of "ONFI".

    It's strange because the EMIF configuration registers look the same in both cases. I will have to think more on this tomorrow.

    Thanks,
    David

    PDI_Assembly_Stepthrough_Regs.xlsx



  • I carefully looked over and compared .map files of both builds and found no significant differences in data and or program memory locations. They merely differ in the number of modules. (Modules in the version with working NAND but broken SYS/BIOS almost look like a subset of the other version).

    Other than that, the only notable difference is at the beginning of the .stack section. In the version where NAND data fails to shift, the beginning of .stack is allocated to boot.ae674 : boot.oe674 (.stack), whereas in the version where SYS/BIOS fails to call Tasks, the beginning of .stack is allocated to rts64plus_elf.lib : boot.obj (.stack).

    Stepping through the loop where the NAND data is read, I find no differences in assembly or even register values, except for the data read from the NAND chip's cache register by the EMIF (address 0x62000000). My previous post includes a record of this. I have triple-checked that all of the EMIF registers are identical in both cases. It really looks like the SYS/BIOS libaries make the EMIF fail to interface properly, but I'm not sure how this is possible if the EMIF registers are all the same.

    On a side note:

    Over the past two months I have repeatedly but respectfully asked Rahul Prabhu for something – anything – in the form of guidance or insight on the issue of SYS/BIOS disrupting the EMIF asynchronous controller. Very little has been offered in response. I have also tried reaching out to Rahul in a private message, which remains unanswered as I type this post.

    I am not qualified enough (or conceited enough) to claim to have discovered a flaw in SYS/BIOS. There is, very possibly, something that I am missing; Unfortunately, I have gleaned very few reasons to think so ...at least until this past week. I feel that Rahul's determined silence on the matter can only be interpreted in a couple ways: either as a combination of discourtesy and negligence, or as a sign that there really is a problem with SYS/BIOS.

    I appreciate your generosity, RandyP, in reaching across to another area and providing assistance, which has been really helpful. If you or Rahul have anything to add in light my recent posts, I will certainly welcome it. Thanks for your time.

    Best Regards,
    David Askew

  • David,

    Like I said at the start, I am not knowledgeable on the hardware or drivers used for the NAND access, but can try to help with debug. Your listings have a lot of good information, and can require as much time to read through as it took you to make them.

    Do any errors show up in NAND EMIF NAANDFSR?

    What physical addresses are the two .stack sections placed in and what size are they? I think you have them attached, but I wanted to get some questions out while I have the chance, for later consumption. The mention of stack always brings to mind the chance of stack overflow, so one 'easy' experiment would be to greatly increase the stack space for at least the failing case. For BIOS when running in a task, there is a separate task stack that gets allocated, if that makes any difference.

    Please send a link to the BIOS disrupting EMIF thread. Rahul is one of the best, which also means one of the busiest on our excellent E2E DSP support team. It is good that he is aware of that issue. That means it is in good hands.

    Regards,
    RandyP
  • RandyP,

    I understand that some of this is not your primary domain, and I appreciate the help regardless.

    Do any errors show up in NAND EMIF NANDFSR?

    No, not in either case. All the EMIF registers look identical in both cases.

    What physical addresses are the two .stack sections placed in and what size are they?

    In both builds the stack section is located at the beginning of L2 RAM, which is 0x11800000 on the TMS320C6748. It's the same size as the L2 RAM: 256kB in both cases. I would think that would be sufficient for a project that is nearly empty save for SYS/BIOS and some NAND drivers, but I'll try playing with the size a bit and see what happens.

    Please send a link to the BIOS disrupting EMIF thread.

    I was actually referring to this thread. You will notice that it started two months ago. During that period I discovered it was the RTS libraries causing the NAND problem. (Explicitly linking another library first, rts64plus_elf.lib, actually fixes the NAND issue, but causes problems with SYS/BIOS operations.)

    Because the DSP assembly code and register data are essentially identical in both cases, I assume that there must be something wrong with the way SYS/BIOS handles the EMIF when interfaced with NAND memory.

    Rahul is one of the best, which also means one of the busiest on our excellent E2E DSP support team. It is good that he is aware of that issue.

    Given the company he works for, I have no doubt that Rahul is both competent and knowledgeable. I have no doubt that he's busy too, but it's hard to make the case that this issue has been simply overlooked. Weeks go by between responses, and yet Rahul continues to be active elsewhere on these forums. I would love to be wrong on this, truly. And I do hope he is aware of the SYS/BIOS-EMIF issue, as you say, though it would be nice to have some indication!

    Anyway, thanks again for your continued interest. I will investigate the stack size idea.

    Best regards,
    David Askew

  • David,

    I apologize for the delayed response on this issue. I have been involved in debugging a release blocking issue for Processor SDK RTOS which is why I have not been able to reply to e2e posts that requires greater involvement than pointing the users to the right resource to unblock them in their development.

    As I mentioned earlier, I have not been able to reproduce this issue due to several missing files in your earlier zip file that you had shared. Also, I was able to add the NANDWriter code to a Task and run it using TI RTOS and SYSBIOS without any issues but it appears that you are also not having this issue based on your earlier analysis. 

    At the moment, the best way to proceed forward would be if you can provide me a self contained project with all the required files and document to help reproduce this issue on the LCDK. From the analysis so far it is unclear if the issue is caused due to TI RTOS configuration/Compiler or some integration issue in your project for me to provide specific guidance. 

    Besides the guidance provided by Randy, it may also be useful to look at the map file, DSP cache configuration. TI RTOS enables the cache for this platform and also uses platform setting from BIOS kernel instead of linker command file. Other thing to try is to down grade the compiler to CGT 7.4.16 and see if this makes a difference. As you can see the NANDWriter in the Flash utility was provided with CCS project and older compiler so I am not certain if this is making a difference.

    Regards,

    Rahul

    PS: I have also asked a C6000 Compiler expert to take a look at the link order and provide comments as to why this would make a difference in this case.

  • Rahul,

    Thank you for your reply.

    Rahul Prabhu said:

    I have not been able to reproduce this issue due to several missing files in your earlier zip file that you had shared. [...]the best way to proceed forward would be if you can provide me a self contained project with all the required files[...]

    You will notice that, in subsequent posts, I have provided what I believe to be the additional files needed to build the project. However, I will group everything into a single zip file and re-upload for convenience. (see below)

    Regarding "a self contained project": I have not included every single source file, header file, and library that the project needs because such a thing would, of course, be enormous in size – and because I assume you already have standard packages such as the MCSDK, CSL, XDCtools, and TI-RTOS. But again, I believe all the other additional files that are needed are included in the zip files. In the interest of portability, I have tried to use path variables in the project wherever possible. Please let me know if you are missing any other files; I promise I will get them to you promptly.

    In the current configuration, you will notice that rts64plus_elf.lib is linked in last, resulting in a "OOOO" response to the READ ID operation. Note that this behavior is the same when rts64plus_elf.lib is removed from the project entirely. If instead you link rts64plus_elf.lib first, a proper "ONFI" response is observed, but SYS/BIOS fails to call any tasks, etc. Downgrading to TI v7.4.16 does not seem to have an effect.

    I understand you are busy with important tasks, and I appreciate you taking the time to look into this issue.

    Best regards,
    David Askew

    PS: Not sure if it matters, but I have a very basic AIS boot image flashed to my LCDK (via NANDWriter_DSP) that just blinks an LED. I have included the image, "boot2.ais", in the zip file in case this could be relevant.

    PDI_Project.zip

  • I can shed some light on ...

    David_Askew said:
    In the current configuration, you will notice that rts64plus_elf.lib is linked in last, resulting in a "OOOO" response to the READ ID operation. Note that this behavior is the same when rts64plus_elf.lib is removed from the project entirely. If instead you link rts64plus_elf.lib first, a proper "ONFI" response is observed, but SYS/BIOS fails to call any tasks, etc.

    If you do not tell the linker which RTS library to use, it automatically chooses one for you.

    I can think of two possible reasons why you see different behavior based on where the linker sees the RTS library on the command line.

    One, the same function is present in multiple libraries, and the wrong one is getting linked in.  To see if this might be occurring, add the option --scan_libraries to the link.  If the same function is present in multiple libraries, you will get a diagnostic that shows you which libraries have the function, and which one gets used.  Read more about --scan_libraries in the C6000 assembly tools manual.

    Two, causing the linker to see inputs in a different order causes things to be allocated to system memory in a different order.  And this difference in order either masks or unmasks some other problem.  Let's hope this is not the case, because it is much harder to track down.

    Thanks and regards,

    -George

  • George,

    Thanks for the advice about --scan_libraries, it's a handy tool. I noticed a few key differences between the two builds.

    There are three symbols – "_stack", "_c_int00", and "_auto_init_elf" – that are pulled from different sources depending on link order. In the version where rts64plus_elf.lib is linked last, these symbols are pulled from "boot.ae674", but when it's linked first those symbols are pulled from "rts64plus_elf.lib".

    There are also numerous symbols which are pulled from "rts64plus_elf.lib" instead of "rts6740_elf.lib " and vice versa. Not sure if that matters as I imagine those two libraries are mostly identical.

    In both cases "_stack" is located at the same address and "TI_STACK_SIZE" and "TI_STACKEND" are the same as well. The entry point symbol _c_int00 has a similar address in both cases: c0055b80 and c0056d20.

    That said, it's not clear to me how any of those symbols could affect the way the EMIF and it's data are handled.

    As for #2, I've compared the .map files of both builds. The modules common between them are allocated in the same order. Also the version with a working SYS/BIOS seems to contains all the modules and symbols of the other .map plus several additional modules pertaining to SYS/BIOS. This fact might explain why tasks and timers fail to work in the one case, but it's hard to see how it might relate to changes in EMIF behavior. Any thoughts?

    Thanks,

    David

  • Rahul,

    Have you had a chance to look into this yet? Do you need any additional files?

    Rahul Prabhu said:
    I was able to add the NANDWriter code to a Task and run it using TI RTOS and SYSBIOS without any issues

    Does your NANDwriter code read from and write to the NAND chip without any problems? If it does, could you upload your project here so I can compare with my projects?

    Thanks,

    David

  • David,

    Why do you have both "rts64plus_elf.lib" and "rts6740_elf.lib" included in your project? That sounds dangerous. Why is just rts6740_elf.lib not sufficient?

    There are many things that can go right or go wrong in trying to re-create someone's failing project build. I have been in the position of having to do that in the past, and worked for days without success. Speaking out of turn for Rahul, the best way to get a solution from Rahul, if possible, will be for you to create a zip'd archive project of the failing file sets (and possibly working file sets, separately) including library files and header files and all of your local source files. Using even minor-release-different libraries can completely change the result. Please confirm it builds and fails, or passes as the case may be.

    Regards,
    RandyP
  • Randy,

    It is SYS/BIOS that includes "rts6740_elf.lib" automatically. I discovered (while trying to debug the NANDwriter w/ TI-RTOS project) that I could get the NAND operation to work properly if I explicitly linked "rts64plus_elf.lib" – the same library used in the original NANDWriter project.

    It's probably easy to miss now, as this thread has become lengthy, but I have stated several times that the result is exactly the same whether I link "rts64plus_elf.lib" last, or if I don't link it at all. The following truth table should sum it up.

     

    Build #1
    rts64plus_elf.lib 1st, rts6740_elf.lib 2nd

    Build #2
    rts6740_elf.lib 1st, rts64plus_elf.lib 2nd

    Build #3
    rts6740_elf.lib ONLY
    (link order unspecified)

    Build Succeeds?

    TRUE

    TRUE

    TRUE

    NAND/EMIF Works?

    TRUE

    FALSE

    FALSE

    SYS/BIOS Works at runtime?

    FALSE

    TRUE

    TRUE

     I agree with you that it's almost certainly an issue of different libraries causing different results. My question is why does build #3 cause NAND-related operational problems with the EMIF? Also, how would I even go about debugging such a problem if I don't have access to the libraries' source code?

    RandyP said:
    ...the best way to get a solution from Rahul, if possible, will be for you to create a zip'd archive project of the failing file sets (and possibly working file sets, separately) including library files and header files and all of your local source files.


    I have provided Rahul with the project and all relevant files. Additionally, on March 27th I repackaged everything into a single .zip file. The only files that are not included are the standard packages which he should already have, such as MCSDK, CSL, XDCtools, and TI-RTOS itself. Those packages amount to several GB worth of data and, again, are files that Rahul already has. He need only change a few of the project's path variables to get it working on his own machine.

    It's unclear, though it sounds like Rahul claims to have created a TI-RTOS project with NANDWriter code that works properly. If so, then a copy of his example project might be all I need to get out of his hair and out of yours! Thanks again for your time and assistance.

    Best regards,

    David

  • David,

    After having spent some cycles to try to build the project, after modifying the paths and build settings, I am still seeing build failures so I had to give up on this way to replicate the issue.

    I have zipped up my project and provided the modified files for you to try in your environment.  The project has a MACRO called FLASH_TOOLS which you need to modify to point to the OMAPL138 Boot and flash tool install location.

    TI_RTOS_NANDWriter.zip

    this project was built using CCSv6.1.3 with Compiler version 7.4.16 and TI RTOS version:  SYSBIOS kernel ( bios_6_46_01_38 )and XDC tools (xdctools_3_32_01_22_core).

    the complete build log is provided here:

    TI_RTOS_NANDWRITER.txt
    **** Build of configuration Debug for project TI_RTOS_NANDWriter ****
    
    "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all 
    'Building file: ../app.cfg'
    'Invoking: XDCtools'
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/xs" --xdcpath="C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages;C:/ti/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.elf.C674 -p ti.platforms.evm6748 -r release -c "C:/ti/ccsv6/tools/compiler/c6000_7.4.16" --compileOptions "-g --optimize_with_debug" "../app.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring app.xe674 from package/cfg/app_pe674.cfg ...
    generating custom ti.sysbios library makefile ... 
    Starting build of library sources ...
    making C:/Users/a0272049/prsdk_am57xx/TI_RTOS_NANDWriter/src/sysbios/sysbios.ae674 ...
    gmake[1]: Entering directory `C:/Users/a0272049/prsdk_am57xx/TI_RTOS_NANDWriter/src/sysbios'
    cle674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/BIOS.c ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/family/c64p/Exception_asm.s64P ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/family/c64p/Hwi_asm.s62 ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/family/c64p/Hwi_asm_switch.s62 ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/family/c64p/Hwi_disp_always.s64P ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/rts/ti/tls_get_tp.asm ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/family/c62/TaskSupport_asm.s62 ...
    asme674 C:/ti/ProcSDK_32_AM57x/bios_6_46_01_38/packages/ti/sysbios/timers/timer64/Timer_asm.s64P ...
    are674 BIOS.obj c64p_Exception_asm.obj c64p_Hwi_asm.obj c64p_Hwi_asm_switch.obj c64p_Hwi_disp_always.obj ti_tls_get_tp.obj c62_TaskSupport_asm.obj timer64_Timer_asm.obj ...
    gmake[1]: Leaving directory `C:/Users/a0272049/prsdk_am57xx/TI_RTOS_NANDWriter/src/sysbios'
    Build of libraries done.
    cle674 package/cfg/app_pe674.c ...
    'Finished building: ../app.cfg'
    ' '
            1 file(s) copied.
    making ../src/sysbios/sysbios.ae674 ...
    gmake[1]: Entering directory 'C:/Users/a0272049/prsdk_am57xx/TI_RTOS_NANDWriter/src/sysbios'
    gmake[1]: Nothing to be done for 'all'.
    gmake[1]: Leaving directory 'C:/Users/a0272049/prsdk_am57xx/TI_RTOS_NANDWriter/src/sysbios'
    'Building file: ../async_mem.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="async_mem.d" --cmd_file="configPkg/compiler.opt" "../async_mem.c"
    'Finished building: ../async_mem.c'
    ' '
    'Building file: ../debug.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="debug.d" --cmd_file="configPkg/compiler.opt" "../debug.c"
    'Finished building: ../debug.c'
    ' '
    'Building file: ../device.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="device.d" --cmd_file="configPkg/compiler.opt" "../device.c"
    "../device.c", line 95: warning #179-D: function "LOCAL_getOPP" was declared but never referenced
    'Finished building: ../device.c'
    ' '
    'Building file: ../device_async_mem.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="device_async_mem.d" --cmd_file="configPkg/compiler.opt" "../device_async_mem.c"
    'Finished building: ../device_async_mem.c'
    ' '
    'Building file: ../device_nand.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="device_nand.d" --cmd_file="configPkg/compiler.opt" "../device_nand.c"
    'Finished building: ../device_nand.c'
    ' '
    'Building file: ../nand.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="nand.d" --cmd_file="configPkg/compiler.opt" "../nand.c"
    'Finished building: ../nand.c'
    ' '
    'Building file: ../nandwriter.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="nandwriter.d" --cmd_file="configPkg/compiler.opt" "../nandwriter.c"
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 219: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 223: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 237: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 239: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 240: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 242: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 245: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 262: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 263: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 264: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/ProcSDK_32_AM57x/xdctools_3_32_01_22_core/packages/xdc/std.h", line 265: warning #303-D: typedef name has already been declared (with same type)
    "../nandwriter.c", line 209: warning #179-D: variable "status" was declared but never referenced
    "../nandwriter.c", line 60: warning #179-D: function "nandwriter" was declared but never referenced
    'Finished building: ../nandwriter.c'
    ' '
    'Building file: ../util.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --include_path="C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/CCS/NANDWriter/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/OMAP-L138/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/ccs/include" --include_path="C:/Users/a0272049/Desktop/Security/Bootloader/OMAP-L138_FlashAndBootUtils_2_40/Common/drivers/include" --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="util.d" --cmd_file="configPkg/compiler.opt" "../util.c"
    'Finished building: ../util.c'
    ' '
    'Building target: TI_RTOS_NANDWriter.out'
    'Invoking: C6000 Linker'
    "C:/ti/ccsv6/tools/compiler/c6000_7.4.16/bin/cl6x" -mv6400+ --abi=eabi -g --define="_DEBUG" --define="SKIP_LOW_LEVEL_INIT" --diag_wrap=off --display_error_number -z -m"TI_RTOS_NANDWriter.map" --stack_size=0x800 --heap_size=0x800 -i"C:/ti/ccsv6/tools/compiler/c6000_7.4.16/lib" -i"C:/ti/ccsv6/tools/compiler/c6000_7.4.16/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="TI_RTOS_NANDWriter_linkInfo.xml" --rom_model -o "TI_RTOS_NANDWriter.out" "./async_mem.obj" "./debug.obj" "./device.obj" "./device_async_mem.obj" "./device_nand.obj" "./nand.obj" "./nandwriter.obj" "./util.obj" "../NANDWriter_DSP.cmd" -l"configPkg/linker.cmd" -llibc.a 
    <Linking>
    'Finished building target: TI_RTOS_NANDWriter.out'
    ' '
    
    **** Build Finished ****
    

    Please check if you are able to build using these files and let me know if you run into issues. Here is a reference output with the DSP-LED-BLINK binary that I had on my machine.

    I appreciate your patience with this issue and we hope to continue to support you to get to the bottom of this issue but with the information we have got from the E2E, we are not able to see the issue and compiler difference resulting in different behavior is outside my wheel house.

    Regards,

    Rahul

  • Rahul,

    I was able to build that project and it does seem to work properly in all respects. Although I'm still unsure about the source of my particular problem, I feel confident that I can figure it out by comparing it with your example project.

    Thank you for all your assistance with this issue. I also want to thank all the other TI people who pitched in to help, including Randy and George. Much obliged, sirs.

    Best regards,
    David
  • Thanks for the update David. I very much appreciate your efforts in working with us on this problem. I apologize for the long delays that were caused during the last 2 weeks but I am glad that you have a way to move forward.

    Please post your solution if you are able to locate the source of your original issue.

    Regards,
    Rahul
  • I managed to isolate the source of the problem, though I'm hesitant to make any claims about why it caused the bug. Perhaps you might be able to shed more light on that.

    The problem seemed to stem from where I defined the flash memory regions for CS2 and CS3. Your project defined them in the linker command file, "NANDWriter_DSP.cmd", whereas I specified them in a custom platform which ultimately meant they were defined in the TI-RTOS auto-generated linker file "linker.cmd". Removing those entries from the custom platform and then manually adding the memory definitions to my linker script seems to be the solution.

    Perhaps those definitions need to be located in the same linker file that defines the ".aemif_mem" section (rather than in linker.cmd)? Though it's not entirely clear to me why that would be. I'm hoping you might have some thoughts on the matter.

    Thanks,
    David