Welcome to the Bogleheads chapter series. This episode was jointly hosted by the starting out life stage and the South Florida local chapter and recorded August 10th, 2021. It features longtime Boglehead 5K discussing investment funding priorities, including investment locations and tax efficiency. Bogleheads are investors who follow John Bogle's investing philosophy for attaining financial independence. This recording is for informational purposes only and should not be construed as investment advice. With a presentation by 5K on prioritizing the investment order, the Bogleheads is a term intended to honor Jack Bogle. Mr. Bogle created the first index fund for retail investors and is the founder of Vanguard. But Bogleheads are investors who follow or use the investing advice that Mr. Bogle advocated. That investing advice, as you know, is invest early and often. Develop your workable investing plan. Never try to time the market. Use index funds when possible. Diversify. Keep it simple. Minimize taxes with cost-efficient investing and above all, to stay the course with your plan, both in bull and bear markets. Just keep saving and just keep investing. And this is where 5K's presentation tonight will be so useful, developing the plan. I would also like to introduce my co-moderators tonight. We have Carol from the pre-retirement chapter and the Dallas chapter. And we have Jim, who you just heard from Chicago. We talked about the recording of the meeting. When the presentation is over again, we will stop recording. We'll have a big question and answer. However, 5K, if he wants to, he can answer questions. He has told us he will answer questions during his presentation if he doesn't feel it affects his flow of his presentation. So you can put your questions in the chat. And Carol and Jim will or 5K will address those questions. Let me see. Thank you. I would like to introduce Gail Cox, who is here. Gail is the Vogelhead who created the life stage investing, the life stage chapter, chapters of the Vogelheads. And we thank her for that. Okay. Onto our presentation. 5K is a long time Vogelhead who posts regularly on the forum. He has many, many helpful posts, his kind, competent answering questions from newbies and oldies. We appreciate. And he's especially good on portfolio, creation, and tax efficient fund placement. He also has his personal financial toolbox, which is a huge spreadsheet. And he has also already given a presentation on that, and you can find it on the Vogelhead blog. I believe it was in March. Okay. 5K, welcome and please the stage is yours. Thank you, Miriam. Everything that's going to be covered here verbally pretty much you can find in various websites. The presentation will have links to all those. The presentation itself will in PDF form be made available after the meeting. And these are not my ideas as much as I'm just regurgitating what various groups of people have put together as these are some pretty good ideas that you might want to follow. Okay. Well, just start out with some general comments. A lot of this is subjective. Reasonable people can differ on the exact ordering. Now you can stretch that, but you can't stretch that too far. Some of the things that you'll find at the top of the list, they belong there. And you don't want to switch them with things at the bottom of the list. And we'll get to the list shortly. As the math is simple, but the equation values themselves are somewhat speculative. Like one example would be what do you think future tax rates will be when deciding traditional versus Roth? And then when we get into the risk versus reward, there is no deterministic answer. You can pay debt at a low known rate. You can invest at a possibly higher but possibly lower rate. And we'll get into that a little bit also. And you know, other than the above, this is all straightforward and that should be a winking emoji there. So it's not straightforward, but it's simple enough. Okay. So this slide and the next slide are very high level views. After these two slides, we'll get into the details on these, but this one is the picture view that you can see how I'm not going to read things. You can read the slide faster than I can talk through it. There's some things that are high priority, things that are sort of in the middle and then things that are relatively low priority. So that's the picture view. You get your emergency fund, your employer match, your high interest debt, then you get into HSAs, IRAs, 401Ks, the whole alphanumeric lexicon, then you get into the taxable accounts and the paying off debt. I mentioned you can find these things on the internet. There's a couple of lists and again, we're going to get into details on this. So don't try to read the small print if you find it difficult. The thing to note is all those green lines, they all match up. So the two particular lists that I'm most familiar with, the one in Bogle heads on prioritizing investments and there's a Mr. Money Mustache, one called, what is it? Investment order. They pretty much say the same thing. They may say it in slightly different words. So if one of them confuses you, try the other and it may, the wording may be different enough that it becomes understandable. But the concepts are identical. OK, so without further ado, these are really the top three. And these are all listed more or less in order. So the top one would be the first thing to do in the next one, the second, and the third one, the third. But you can mix and match. So we just go through these a little bit here. So the emergency fund. Lots of so when we talk about emergency fund, we'll talk about traditional versus Roth later, we'll talk about pay debt versus invest. Any one of these individual topics, we could spend an hour or two on. So this is a high level of you. So the emergency fund to your satisfaction. You know, I think it's pretty non controversial to say that you should give yourself at least enough buffer that you don't have to worry about bouncing checks from month to month. So you need at least the next month's. Bills in your emergency fund, you know, beyond that, you need three months, six months a year, two years. That's a personal thing. So two year satisfaction. Next one would be get the employer match. If you've got a 401k or 403b, that's going to give you a one for one match or even a 50 cent per dollar match. That's the highest return you're going to get. Even in the next point, you've got credit cards, even if you're paying 20, 30 percent interest on your credit cards. If you can get a one for one match from your employer, that's 100 percent. But there is a reason why high interest debt, for example, credit cards is very high on the list here. You know, high is is somewhat relative. What's high for one person who's very risk tolerant might not be the same for someone who's more risk averse. There's no right answer. It's personal finance. And these mix and match. So take the emergency fund and the paying off the credit card debts. If you're sitting there with six months expenses in your emergency fund, but you owe $10,000 on a credit card that's you're paying 25 percent per year interest on. You might call that credit card debt an emergency and dip into your emergency fund to wipe out the credit card debt. So the emergency funds are there to be used. So if you've got something that you think qualifies as an emergency, go ahead and use it. Now, if you're using your emergency fund to pay off your credit card every month, and that's a different story. OK, so that's that's the top three. I'm just stop here if there's any questions on those top three. Anything in the chat? I saw it was flipping by too fast for me to concentrate on as I was giving the presentation. But are there any open questions at this point? All right. Hearing none going once or twice. All right. We shall move on. So the middle four. You can pay tax now. You can pay it later. You can pay it never on these four options here. So the first one and the reason why it is the first one with a health savings account, if you're eligible for one. And again, we can get into gory details on what makes one eligible for a health savings account in terms of having a high deductible health plan. But if you're eligible, you get a tax deduction on your contribution. You don't pay tax unless you live in what? California and is it New Jersey or just California? But you don't pay tax on any gains. And then when you take it out to pay for medical expenses. Somebody. OK, so it is California and New Jersey. But the other 48, they're they're a great deal. They're even a good deal in California and New Jersey. They're just not as great. OK, so that's the one sometimes you hear them referred to as triple tax free. You get the tax deduction, you don't pay tax on on annual gains and then you don't pay tax if you take it out for medical expense. So then we get the next to the the traditional or Roth IRA and the employer plans. And again, remember, with the employer plans, the the top three or the employer plan showed up. That was just up to getting the match, the maximum employer match. So this would be getting going up to the IRS limit to nineteen thousand five hundred for 401ks. But the reason that the traditional or Roth IRA comes before the employer plans on this list and you see there's a double headed arrow. So they can swap. But IRAs tends to have lower fees and almost by definition, they have more investing options. So if they have a lower fee, then your 401k, your 403 be offer. Then go with the IRA first. But they don't always have lower fees. Sometimes you get institutional funds in 401ks and hey, just fill up the 401k. And sometimes you want to use the 401k because it can reduce your modified adjusted gross income for something like the earned income tax credit. Whereas the IRA may not be as efficient at doing that. So the IRA and the 401k, yeah, the default order is IRA first. But there's plenty of examples where you would want to do the 401k or 403 be your 457 ahead of the IRA. And then you get into for those who happen to have it available. You typically if you work for a large company and they offer an after tax non-Roth 401k option, you can do something called the mega backdoor Roth process, which is a little bit different from the plain old backdoor Roth process you see in the second bullet point. But it does get after tax funds into a Roth account instead of a taxable account. So that's a good deal. There was a comment. Yeah, there's another example on MAGI of healthcare subsidies. That may be another reason that you'd want to use a 401k in preference to an IRA. And all these are, if you have to make a choice, if you're in the wonderful position that you've got enough disposable cash that you can fill all these up. Well, then great, it doesn't know the order doesn't really matter. Questions about that middle four or anything else at this point? Yes, I have a question 5k on the mega Roth. You mentioned the mega Roth. Can you explain what that is? So if this is so mega backdoor Roth is something that goes through an employer plan, so 401k, 403b, most people are familiar with the concept you can contribute to a traditional account in your 401k. And when I say 401k, just assume that I mean or 403b, you can contribute to a traditional account or a Roth account. Those are, you can elect which one to do. There's a third option that some employers offer, not all, but some. And that is after tax, non-Roth. So you can contribute after tax. But it's not immediately going into a Roth account. And it sits there. It's like like a non-deductible traditional IRA contribution. So that's nice, but not all that interesting. Unless the employer plan also allows you to take that non-deductible after tax account and roll that over to either. The Roth version of the Roth account within the 401k, or if the employer plan allows you to distribute that out to a Roth IRA. So you make this after tax non-Roth contribution, where if you don't do anything with it, it just sits there. You're not paying any tax on any gains while it's sitting there. But when you withdraw it, you now pay tax on the gains at ordinary income rates, unless you have the option to take that account and roll it over immediately or within a month or two or even a year into a Roth 401k or Roth IRA. And there's a whole, there's two wiki entries, one on after tax 401k, one on the mega backdoor Roth process. So they're related, but not identical. Does that cover it in enough detail? Yes, but does that mean that the mega Roth, it's a mega 401k, correct, mega 401k Roth that it differs from your regular 401k, regular 401k, your regular Roth 401k on the taxing of the earnings? Correct. So there's and where do I start with the processes? So there's a backdoor Roth process, which involves multiple steps. And there's a mega backdoor Roth process that also involves multiple steps. But the two of them are different. The regular backdoor Roth process refers to what you do with IRAs. The mega backdoor Roth process refers to what you do with your 401k. So the process for both of them involves you make a non-deductible contribution. So it goes into an account, you did not get to deduct that contribution from your taxes. But if it stays in that account, while it grows, you won't be paying any taxes. But when you go to withdraw from that account, you'll pay tax at ordinary income rates on any gains. So up to this point, you know, if you put it in the account, you didn't get to deduct it, it's growing, you're not paying tax, but then when it comes out, you have to pay tax on any gains. Kind of interesting, but maybe not all that interesting. What makes it very interesting is if you can take that non-deductible amount and then convert it immediately to a Roth account. So when you do that conversion, if there hasn't been any gains, you're not going to pay any tax. But now you've got it into a Roth account where you'll never pay any tax on it. So you've got people sometimes say, you know, I'm going to put it in my backdoor Roth account or I'm going to use my mega backdoor Roth account, which is plain a little fast and loose with the language. Those backdoor things are processes that involve a contribution to a non-deductible account and then a conversion to a Roth account. Does the mega backdoor, does the mega backdoor Roth stay in your employer plan until you take it out and you roll it over to a regular IRA, is that correct? I'll give you a definite maybe on that one. It depends on your employer's plan. Some employers allow you to roll it into a Roth, into your Roth 401k account. Some employers allow you to do what's called an in-service distribution and you can get it out of the 401k completely and into a Roth IRA. Either one of those is perfectly fine. It really doesn't matter as long as your employer plan allows you to do either one. Okay, thank you. You're welcome. All right, anything else on this before I move along? Okay, I think there was a question in the chat, what tax bracket should you use a Roth 401k versus a regular 401k? Oh, okay. Let me go back to... So, you know, even when the math is simple, equation values may be speculative. It really, it doesn't matter what your current tax bracket is as much as it matters. How does that compare to what you think your future marginal tax rate will be? You notice I use marginal tax rate instead of bracket, and I really should use that. It depends on what your current marginal tax rate would be, which for some people is their nominal bracket amount, but for others, it's not. You need to compare that to what you think it will be in the future. So, we can go after I'm, so this presentation is mostly on the investment order. We can certainly go into Roth versus traditional after this one is done. And as I said that, you can take at least an hour on that alone, but maybe we can keep it a little shorter than that. But there is no, I mean, there's sort of rules of thumb, but I really don't like rules of thumb in traditional versus Roth because there's a huge number of exceptions to them. And one rule of thumb would be, well, if you're in the highest tax bracket, use traditional. Well, that's a great rule of thumb, unless you're going to stay in the highest tax bracket even after retirement, and then you should use Roth. Another decent rule of thumb is if you're in the 12% bracket or lower, you know, if you're in the 12% bracket use use Roth. And that's a pretty good rule of thumb, unless this is someone who's late to the party and they're in their fifties and haven't had much saved and probably never going to pay tax in retirement, so they should use traditional. So I just, I don't like rules of thumb because there's too many exceptions when it comes to traditional versus Roth. Again, that's a personal opinion. Okay, any other questions before I go on? All right. Okay, so now we're kind of towards the bottom of the prioritization list and taking care of the top ones, you know, get your get your house in order so that you're not bouncing checks and get that employer match that 100% return on your investment. Get those credit cards paid off and we're through the all of the tax-advantaged options, the HSAs, the IRAs, the 401Ks. So now we're down to, okay, do I invest or do I pay off debt that I have? Good question.  It's a little tough since there is no maximum on taxable investment, you could reasonably ask, how do you ever get to paying off low interest debt? That's a good question. You can think of those two maybe as as parallel rather than one right after the other. And it gets into your risk tolerance or your risk aversion, just how do you define things? So there's one definition of medium interest debt that you'll find over on the money mustache one. And again, it's just a definition 3% over the 10 year Treasury note yield, which 10 year Treasury's been what about one and a quarter percent averaging over the past year. So I might say medium would be over four and a quarter percent. So, you know, that would say 5% would be medium interest debt and you ought to pay that off and 4% should be that would be low interest debt. So you should invest taxably. And some people would say, yeah, that makes sense. Other people would say 5% and that's that's pretty low. I think I'm going to earn more than that. I'm in this for the long haul. I'm 100% stocks away I go. Other people would say 4% gee, that's a great return. That's a guaranteed investment return. I'm all for that. I'm going to pay off the debt before I invest. And so it's it's personal, but these are some of the things that you might want to think about when when you're making your personal decision. Other considerations that often pop up with questions. A common question is where where do you put saving for a house down payment in this this ordering. That's really up to you. You can either say, hey, this we really want the house. We're going to consider this a day to day expense like going out and buying groceries. You know food clothing and an eventual better shelter. So, you know, we will do that. That's that's just something that we're not going to consider that an investment that's at risk. We're going to go buy chicken and potatoes and milk and then we're going to put a bunch into our down payment fund or people can say, you know, okay, yeah, we're renting here. We've got an okay house and we'll invest. And if things work out, it will take money out of investments later and buy a house or buy a bigger house. But no, we're in no rush. So again, that's either one of those is perfectly defensible. Another question is where to 529 plans come into this. That's another personal thing. I kind of like the analogy of do that only after your your retirement plan is set.  Another phrase that I've heard is you can borrow for college, but you can't borrow for your retirement. But that's a personal thing. Some people consider it extremely important to be able to pay their their kids college. So you have that as a higher priority.  So you don't own a chain of dry cleaning stores or you don't own a food truck that you're looking to grow your business. If you are self employed in that way, if you own your own business, you really need to look and figure the return on on your business investment and decide where that fits in with all the investment options of IRAs and solo 401Ks and so forth and so on. And that is it for the formal presentation on prioritizing investments. So where are we with questions. And I see some more ones here. Chat asking what's a reasonable amount to put per month into a 529 and for young kids. You know, there is I don't have a good answer for that. If someone wants to opine on that you know that depends. Do you is your kid going to go to Harvard and you want to pay for all four years plus a PhD and You know In whatever Then you need to be putting in a heck of a lot. You know, as your Kid going to go to enormous state university and is likely to get a some sort of athletic scholarship. You know, you probably don't need to put in as much. That that's a really personal one. I don't have a good answer to that anyone does raise your hand or open your mic and I'll be quiet for a bit here. Well, one thing I would say is that the earlier you put the money into the 401k the more time it has to grow. And so it's kind of like a front loading. I view it as kind of a front loading effort to put as I mean I realize that saving for retirement is important, more important, but if If there's any way to front load the five the 529 early. Then it has more time to grow. It only has 18 years to grow the life of the 529 is shorter than the life of your retirement. You're investing for retirement. So it's kind of like a different type of an account. It sort of behaves a little different, but most of the 529 plans do have a Like a glide path similar to a target date refund or target date retirement fund where it will glide down to bonds. So if you put your money in if you intend to put more money in towards the end of the 18 year period, you're going to be in a more conservative portfolio. Or you're going to take more risk that the market will drop before your child goes to college. So I see a reason to front load it as much as you can. There was a long post about after tax money choice between regular taxable account and mega backdoor Roth and RB suggest it's always better to use mega backdoor Roth and I would agree with that. That's why It shows up in this middle four as opposed to the bottom three. So Yeah, we talked about you can sort of flip flop some of these. But I think that top three. There's there's a pretty bright line between the top three and the middle four. And there's a pretty bright line between the middle four and the bottom three here. I suppose someone might be able to come up with an exception, but I can't off the top of my head. What else do we have in chat 529 529 there's another question I can read out if you want to sing is from Deepak. He said My state 529 plan has a state tax deduction. I thought of this as a guaranteed return on my investment and hence prioritize it a little higher my taxable accounts. What are your thoughts on this.  Now that that makes sense to do that. Have to be a word we've done personally. We weren't really all that we were lucky with what we did on on our personal finance worked out okay, but we didn't really know what we're doing. But what we do now with with kids still going through colleges. We put in the maximum 529 that we can to get the state tax break and then we take it right out the next year to use it for tuition and room and board. So yeah, this if you're in a state that gives you a state tax break. Might as well take advantage of it. And a while back there was a question in the chat if you don't plan to retire in the US. How does this any of this change if at all. Great question and that would probably depend on where you're going to retire and how that country treats. IRAs and 401ks in the US and I am absolutely not an expert on those not even close to being moderately informed on those so if someone else will have to weigh in on that. Okay, I actually question as well you know what if you know you sort of have low to medium interest debt somewhere in between, you know say like two and a half percent. You know, and you know you weren't really sure how things were going to go in the future would you focus on paying off the debt or investing or I guess how would you make that decision if you really run sure as to the trade off there. Well, one thing you can follow these suggestions and two and a half percent at the Bogleheads wiki does not define high, medium and low. The money mustache one gives some suggestions but I don't think it even pretends that those are holy writ suggestions there there's some guidelines. So if we were to go with the definition of medium as being 3% over the 10 year Treasury note yield and that one and a quarter percent roughly so medium would be four and a quarter percent. So you said two and a half percent so that's under four and a quarter so that would be not medium interest debt that would be low interest debt. And if you follow this ordering you'd you'd never pay it off until you paid it off by paying it monthly. But if you're staying up at night because you can't stand debt and then you're losing sleep. Well, then maybe you want to pay it off. Can I contribute something to that point as well. Sure. It's it's rather helpful if you simplify the debt question. So for instance if you're paying two and a half percent in interest on any form of debt. You can also look at that as a way to give yourself a two and a half percent raise on your income by eliminating that debt. Furthermore, if you plan to invest while carrying the example two and a half percent debt and let's say you're receiving a nominal which is pre inflation return say four percent. You're not really receiving that four percent because if you're paying two and a half percent on debt but receiving four percent. You could do the math and you tend to be spinning your wheels so it's always prudent to pay off the debt first and then jump into investing to maximize that those efforts. That's that's one way to look at it. You know other people could say that they're they're not investing in bonds at all and they expect their stock returns to be higher so it's never say always or how does that go. Unless there's something I'm missing. But if you take someone who's decided they want to be 100% stocks. And they're saying that the expected return is higher and then they're willing to run the risk that that expected return does not materialize. Then I think that they have made a defensible choice to not pay off their debt. David Gravener has a question. Five K were you finished. Yeah. Yeah. Okay. David you have a question. Okay. Christina you have a question. Yes. I'm wondering I also put it in the chat but I'll just go ahead and stated here I'm wondering as you move closer to retirement. Should you consider moving most of your money into an after tax account so that you're not quote unquote surprised by the taxes you're paying when you're drawing down from pre tax accounts like 401k or you know traditional IRAs. I think the answer is in your question. And that would be don't be surprised. You might want to do Roth conversions. Or you might not. While you're still working. It's usually not beneficial to do Roth conversions because now your Roth conversion amount is being added on top of your salary or your wage income and so you're going to pay a pretty high marginal rate. Usually. Right, but doesn't a Roth conversion assume like I'm excuse my ignorance here but doesn't a Roth conversion already assume that you're, you're making a certain amount of money so I'm, I'm working from the point of view that you're not making so much money that you can do.  And you're putting all your money in into that, but perhaps as you move closer to retirement.  So, at what point I'm wondering, should you be trying to move money or should you, maybe it's not about moving money maybe it's just simply about putting money now into let's say a Roth account of some sort. I'm just really trying to figure out like, how do you avoid paying taxes you don't need to pay.  There's lots of ways to do it. You know if you use, you can pay a CPA to tell you. You could use turbo tax and you can say, well okay here's what it would be. Here's my base and now if I were to do $1000 Roth conversion how much more tax would I pay and you know what's that divided by 1000 so what's my marginal rate on that, so forth and so on. There are spreadsheets that will do all those calculations for you and give you a chart that will show you what your marginal rate would be for your Roth conversion. The whole, the whole thing on Roth conversions or traditional versus Roth it boils down to. It's the, where is it here. You really want to understand the rate. Okay, so with a Roth conversion. If you're, if it's going to cost you 24% to do a Roth conversion now. But you expect after you retire, you can take money out of your traditional account and only pay 15% then wait. If it's going to cost you 12% to take your money and do a Roth conversion now, and you expect after retirement, you're going to have a pension kick in and you're going to start social security so you're going to be paying 22.2% Then don't wait do that conversion now at 12%. So it really it's a, it matters what your situation is what your tax rate is going to be now, and what you think it's going to be later. Thank you. Thank you.  I can say Christina is that for me for our family. We were surprised when we retired that we were in a higher tax bracket than when we were working. And we did not expect that. But life has its way of changing your tax expectations. We have pensions and also our MDs. My husband went back to work with 401k with, I'm sorry, W2 wages. And before you know it we're back up in a higher tax or in a higher tax bracket than when we worked. There are many Bogle heads who did find that I read them on the forum, and also many Bogle heads are in, more or less the same tax bracket, just more or less the same tax bracket when they retire is when they were working. Thank you, Mary. And that's very helpful because what you just described is what I'm, what I'm talking about. Exactly. So that was very helpful. Thank you. It's like, you can try to plan, but I mean I'm not quite at or near retirement yet, but you thought you were doing all the things you needed to do and then yet you get in retirement and it's like surprise surprise so that's helpful. Thank you so much. Oh, you're welcome. Also, David Graven are you unmuted now. Yes, I'm on mute. Okay, you're on. I want. Yeah, I want to clarify the way to look at the at the paying down a debt for investing a decision. So, so it's trying to take an objective look at this. So, if you pay down, if you pay down alone you're getting a risk-free return equal to the rate on the loan. And so you have to decide, would you rather get a risk-free return equal to the rate on the loan or the rate on your investments. If you hold a bond, you're getting a low risk return equal to the rate on the bond. So that's that was a five case point about if you're 100% stock, then then then it might well make sense to hold to hold a debt that's sufficiently by bond rate. You'd rather get a you'd rather invest in stock and expect 7% with a lot of risk than get a risk-free 3%. If you hold a stock, if you hold a bond yielding 2% and a loan at 3%, then if you sell the bond to pay off to pay down the loan, you're getting a guaranteed 1% benefit without changing your risk. So unless there's some other reason you wanted. And so, if you have any bonds at all, then unless there's some other reason and there may be, you may need to keep the money liquid. It's often better to it's usually better to max out your 401k rather than paying down a mortgage because you get tax for growth for a long time. I think that that's the one I tend to make on the forum that if you are actually 100% stock, and you will then you then it may make sense to borrow it a lot more. There's more than significantly above bond rate. If you, but if you hold any bonds, you can view your mortgage as a negative bond. And, and therefore paying down the mortgage is a better is a better kind of quote bond to buy. If it's rate is significantly higher. And if you can pay down and if you don't get any other benefit like liquidity. And I equities useful but I, but I, I, I don't think it's on the form I don't, I think unless you're 100% stock I would certainly pay down a mortgage that's 3% above the Treasury yield. Thank you, David. And this that's covered pretty well in the, the paying down loans versus investing wiki article, which that's where it's linked. Um, yeah, I've, I've actually just, I'm one of the contributors that articles. So I, that's why it does show it does show my, it just show a lot about what I how I think about the problem. Yep, I think it's well written. Okay, does it depend on the type of debt, like a student, what about student loans, paying off student loans, rather than investing for retirement. That is often discussed on the forum that I suppose it could. That's getting to be a really sharp pencil there to make distinctions. And that that is that you can get into callable versus non callable and, you know, all that sort of stuff but I think if we're going to stick with the Boglehead principle of simplicity, let's just say that is that And then one other thing I'd like to add to on the topic. I think often gets overlooked because a lot of people start comparing the different rates, you know, carrying debts versus investments. It really boils down to cash flow. If you're carrying debts right, not only are you paying an interest rate on that borrowed amount of funds but you're also servicing that debt and therefore that cash flow is flowing out of your expense column, rather than staying in your asset column. And so the more money that you're paying out servicing debts of say credit cards, student loans, car payments, XYZ, just let's just call consumer debt. That's less money that you're contributing to your investment efforts and therefore a smaller nest egg at retirement. Obviously there's no perfect plan and then and as previously mentioned there is never a rule of thumb but it's worth considering that paying money out in terms of cash flow to service debts is money that you're not investing and so one should seriously consider that opportunity cost. Thank you Michael. Well, do you have a question. Yeah, there was a question in the chat a while back and I know this is kind of like a whole other topic but the question was what assets should go in a Roth versus a traditional RA versus taxable account and I know that's a big question. The one or two sentence answer and again there's a whole wiki article that goes into pros and cons and conflicting opinions but the one or two sentence answer is you put your high expected growth things in your Roth, your low expected growth, like bonds in traditional and you know taxable. You try to make that as tax efficient as possible. That's my quick answer but anyone else is certainly welcome to chime in. That's also we're noting that bonds pay interest but you're typically taxed at marginal rates. And therefore in some of Bogle's books he definitely highlights and mentioned some of the potential benefits of placing fixed income within Roth's which are obviously a post tax contribution so the interest earned on those bonds within Roth as it compounds over many decades is a serious advantage because you're not paying any taxes on those interest payments. Right so this is John I'm the one that posed the question. I struggled with the question of what to put in my Roth account because it those are a finite amount of assets.  So I, I'm trying to be choosy about what I put in my for my Roth account. And so I struggled between, you know, like you mentioned, higher growth stocks, but also have things that pay, you know, pretty good dividends and I don't necessarily want to pay taxes on like a high yield fund or a Verizon, for instance, that pays you know four and a half percent dividends. So that's just my struggle. And I just retired so that's my, that's my context. Congratulations. Let's see, then there's a right under that there's a question on mega backdoor off currently invest lots of offered. Oh, don't worry about being confused to join join the crowd on that the whole, whether it's a regular backdoor or a mega backdoor mega backdoor, they can get confusing. So what you would need to understand is do you have a third option in your 401k. So you have the traditional pre tax, you have the Roth goes in after tax. And you need, you need to find out if your employer also offers after tax non Roth. That's, that's the first step. So does your employer. So you can contribute up to 19 five, or if you're older some more to either the traditional or the Roth. So that's that $58,000 limit that's employer contributions in the 19 five and, and anything else that you kick in. So that's where the after tax non Roth comes in that if your employer, you know hasn't matched you to X or whatever. You still have this room. If your employer allows you to put in after tax non Roth, you can do that. And then you need to. So that's step one step two is, does your employer also allow you to then immediately or in the relatively near future, allow you to take that contribution and roll it over into a Roth account, either outside the 401k or out to a Roth IRA. So it's a two step process and you need to check with your employer on whether both of them are allowed. I just had that question there. I think someone had also asked in terms of the gains before the mega backdoor is completed. I believe you pay taxes on those gains that correct. Oh yes okay yep taxes are paid on the gains that's correct so you know if, if it's gone up by $25, you know, because you waited a month, you're going to pay tax on that $25 but I wouldn't let that hold you back. And it sounds like the best way to really find out about that is to contact your employer and your plan. Okay, that makes sense. And I think there was a question in chat asking, does the sales rental property capital gains on that rental property, effective distribution of from IRAs on your tax return. Okay, hang on to that. Let me just check with Gail of North Texas to that answer your question. Thank you. Okay, sorry, many what was the one about the capital gains. The person was asking, does a sale of a rental property capital gain affect the distribution from IRAs and your tax return. Well, it depends. So again, if you're in one of those, those zones where your capital gains aren't not being are not being completely taxed or, you know, you're hitting the NIIT boundary and so they're going to be taxable more. If you're in one of those, then additional ordinary income gets taxed at a higher marginal rate. Otherwise, no. So that's another one of those. It depends answers. Does that make sense. And if it does make sense to everyone I'm amazed, because it's not something that's obvious. Sounds like it's a complicated answer. I think that that makes sense to me. I mentioned in the chat that presentation you gave us at Chicago a few months ago where you use the financial toolbox that was a really good thing to play around with some numbers to see the financial impact and the tax consequences and marginal rates, effective rates, all that. So I put the link in the in the notes here in the chat. If we have some time tonight, I could. I think you put yourself on mute. Sorry, that was me sorry. Oh, okay. All right, I'm not not sure what got muted. Okay, that's fine. Okay, would you say that our young investors should aim, or it would be good to arrange their order their their investing so that when they reach retirement. They very much have a nice pot of money in their pre tax, a nice pot of money in their after tax Roth, and money also in their taxable account. It really depends on what their marginal tax rate has been through their employment. That's a common question people say well what what percentage should be in which bucket. And it's really not the best that percentage is a consequence, not a goal. So the goal is, you want to fill up your traditional account up to but no higher than. You fill it up by by saving as you put into your traditional account you're saving some certain marginal rate, 12% 22% whatever if you're in the earned income tax credit area, you know, you can be saving a high marginal rate. You know if you're paying and it can be paying, you can be saving a higher marginal rate, etc. So you want to keep filling up that traditional account by saving that whatever marginal rate you're saving at, until it gets large enough that you think that when you start to withdraw from that traditional account, you're going to be paying somewhere close to that same marginal rate. If you got someone that's making relatively low income. They may end up with 90% of their investments in traditional because they're going to be pulling it out at a fairly low marginal rate, where you take someone, you got a brain surgeon who's making half a million a year whatever. They're going to have a relatively small amount in traditional because they can only put so much in there. And they're going to have a whole bunch in taxable and Roth because it spilled over. So, I can understand why people want a percentage because that's a nice easy thing to look at but it's really the percentage should be an outcome, not a goal. We actually have a question in chat on that. It says, is there such a thing as too much money in a raw versus traditional IRAs. In other words, if I only have Roth funds with no more traditional IRA funds, aren't I wasting some of my efficiency. If you have, if you have everything in Roth, and I mean everything so you're not paying any tax at all in retirement then yeah you missed a bet you should have. You should have made some traditional contribution and saved taxes back at that point. Sonya do you have a question. Sonya you're on mute. No, sorry as a mistake. Okay. Okay, someone else had a question in chat. Any thought on placing similar asset allocation funds and tax and tax deferred accounts wouldn't be 100% tax efficient but you avoid behavioral issues and you get automatic rebalancing. And what are your thoughts about that. And the other advantage that they pointed out was you might be able to do similar amount withdrawal across all accounts when you need to spend an retirement. trade off between simplicity and optimization. And both of those are somewhat subjective, you know one person's simple as another person's complex and one person's optimum is another person's not worth it. I can't improve on the pros and cons in the tax efficient investment wiki. I mean just have a problem that curious, has anyone actually looked at like you know, what are the percent differences, you know, in, you know, for instance accounts, if you did that, versus doing something that's more tax efficient like how much of a difference does that make at a retirement time. I'll let anyone else who wants to weigh in on that one. Manny, could you ask your question again, was it your question or a question from the chat. This is my question I just more curious based off that question but you know essentially, you know, they were saying, you know, simplicity versus more complexity. You know if you had similar asset allocation and tax and tax deferred accounts versus doing a more tax efficient asset allocation. What's the actual difference in retirement like what's the percent difference you might have in the amount you're able to withdraw, you know, in retirement.  Yeah, yeah, yeah, if you were to, you know, rather than just putting similar asset allocations across tax and tax deferred, exactly to put them in a more tax efficient manner. So it wouldn't be, you wouldn't be committing tax drag. Well, I can, I'm even when I was working, my raw account, I had mostly stocks. And the reason was I wanted it to grow, because it was my account I was anticipating to be used for health reasons for since we do not have. We don't we have health insurance but we don't have long term care insurance. And so I was wanted it to be big for that. And also to leave to the kids. I simply wanted it to grow I could not get over. It just seemed to me that it was tax free all the growth in my Roth IRA was tax free. I was going to grow and grow and grow. And it just seemed to me I just could not get over how it would grow big if I had a lot of taxes, a lot of stocks in there for what I needed in the long term future. Is that what you're talking about. Yeah, no, that makes sense and I was really wanting like what is the actual difference in retirement, you know, someone didn't do that and they put, you know, tax it like equities and bonds in their tax protected accounts like what would the actual difference be but it sounds like it'd be it's beneficial really or it could be beneficial to believe stocks in those tax accounts. So Jack Bogle's guide to investing book. There's a chapter near the back of the book somewhere I should have it here in my library, where he does a small little breakdown of exactly what you're asking and does a comparison of putting X amount of dollars in a taxable account and then taking the same amount of dollars and putting it in a tax deferred advantage account. Additionally, whether you select equities or bonds and what the resulting. Investment total would be at the end, considering tax drag that you're referencing so I don't know if you can get your hands on that book. But I think that may point you in the direction to what you're asking. The tax drag from a taxable account, Michael, is that right. Not from not the tax drag that comes, or the taxes that you pay when you withdraw from your traditional 401k or your traditional IRA, right. You're talking about taxable account versus a traditional IRA or a traditional 401k. I was just trying to reference that chapter in the book that may have helped the gentleman asked him the question, if it, if it may have, you know, help clarify his question. It just came to mind because what he was asking seemed to be similar to what I recall reading in that chapter of the Bogle heads guide to investing book. Thank you. Okay. Let's see question about I bonds, with which I am not familiar so someone would like to weigh in on epochs question on I bonds. I do have another question on teachers and 403 B plans. We do have many teachers on the Bogle heads. And I know that they have a weird setup with their 403 B plans. How does that fit into your investing priorities. Should they like, you know, abandon and get out of them that they really could and move into Roth's and traditional. They also have annuities, which sometimes are not the best investment for them. And no, there's a link in the money mustache. One I'm not sure if there's a link in the wiki if there's not. I'm sure we could put it in there but it goes something like, you know, if you have, if you have poor choices in your 401k. And it refers people to the Bogle heads wiki article on how do you decide how, how poor is to poor. And David Graven or could could go into more details on that but there's there's some calculations you could do. There was a recent thread where someone was paying I think the total of about 0.3% in their 401k or maybe it was a 403 B. And they thought that this this was terrible and you know while it's not as good as a 0.04% for 401k or 403 B it's by no means terrible. If you're getting up into two and 3% you know that that can be terrible and especially with teachers who may stay with the same school district for a long time. But yeah that's that's just something that they need to look at just how bad is it and sometimes 90% of the funds are really terrible. But there's a, there's a Vanguard S&P 501 in there that the salesman never tell you about but if they look closely they can see it, or, or something similar. Thank you. Mega man, are you, you have a question. Yes, I wanted to circle back to the Roth versus traditional IRA. And the question was, is there, is it possible to have too much in the Roth and I think the answer is yes. If you've got 100% you're losing tax efficiency at some point. I've got about 70% in my Roth, and I'm retired for 10 years. So we're really, it's nice to have both because it gives me great flexibility for taxes, especially in when you look at the tax brackets. You can jump at from 12% to 22% tax, whether you're making, and that's if you're making 20,000 a year up to 81,000, you're paying just 12% tax. So that's a 10% spread. So I can, I can use my taxable funds up to the 81,000. And then if, and then I can, if I need more I can just take it from my Roth. So I can, you know, 300, 400,000 for that year I can take out of my, my Roth. So I think in those particular, that bracket is 8% or 10% spread, and then the spread from 173,000. This is joint married couples up to 330,000 that's a 24% bracket up to a 32% brackets that's an 8% spread. So if you're in that bracket you'd take your traditional up to the 173 and pay 24%, but use Roth money that if you need more beyond that because you don't want to be in the 32% bracket. So that's what I like is, is keeping, keeping the bracket. And I know where my taxes going to be. And I have the flexibility because I have a lot of Roth and, and I also have traditional. Thank you. Sure. Hi, Katie of comments on that. I agree. Lady geek has put the link to the expensive or mediocre choices and some I bond as well so I love it when there's a good person filling in the answers in chat so thank you. Okay, thank you. Could you go over 5k. What the difference is between tax brackets and marginal tax rate, and how young investors who are, you know, don't want to learn who do not want to get into the weeds of taxes, but they want to just, you know, create their portfolio, a simple portfolio. Do they have to worry about marginal tax rate versus bracket can they just look at their tax bracket and they'll be pretty safe in assessing their portfolio or their investments. No more to put them probably. I mean the whole Roth versus traditional thing. We're just nibbling around the edges on that anyway. And if someone's going to agonize over Roth versus traditional they should just invest and flip a coin. So, the short answer is yeah they can just use their, their tax brackets. But you did ask about young investors so I'm going to make the perhaps unwarranted assumption that if you're talking about a young person. They can handle a spreadsheet. So, let me. I'm going to show how easy it can be. Let me. So okay so we're going to do young. So let's say we've got a young married couple and they're both 35. Can people see this spreadsheet. Yes, is this your personal toolbox spreadsheet. Yes, it's the one it's, as I've said, I can answer probably most questions about it been detailed questions go back to the money mustache forum where it's hosted there but yeah I can probably answer any beginner questions about it. I find it a very useful tool. So, okay so we've got. So we've got married. So let's say they've got two kids. They're both under 18. They're both under 13 one of them's under six and they both qualify for an income credits that depends on what kind of earning so let's see, let's say we've got one of them's making gosh I don't know $60,000 a year. I don't know if the other ones making $40,000 a year. And they want to know if they make 401k contributions. How much is that going to save them. So, you know. So they are, they are firmly in the 12% bracket. So if, if all they knew was that they were in the 12% bracket. You know that would have been fine because they they are so firmly within that that if they both contribute the maximum to their 401k then they, they get down and they just reach the first tier of the savers credit, but because they had to put over $30,000 in there just to reach the first tier of the savers credit, it really doesn't change their marginal rate very much at all. You're still at 12%. So if you've got someone in that situation, they say I'm in the 12% bracket I'm going to, I'm going to roll the dice and figure this is the lowest tax rate I'm ever going to pay and they go all raw. That's a defensible choice. But let's change things a little bit around here let's say. One of them decides, I'm going to, I'm going to go on. I'm going to see the boxer changing if you can just mention what you're changing when you just. Okay, so. So, I had set up so I'm in the upper left here that one of them was making 60,000 the other was making 40,000. Over here they've got a couple of kids. One of them's under six and one of them's not saying one of them's five the others 10 whatever. And so this was their only income, and they were, they wanted to know what should they do with their 401k should they do traditional or off. Well in that case, they're in the 12% bracket they are firmly in the 12% bracket so I'm down here looking at the chart, and it's 12%. I don't know how much they contribute to the 401k, except for that one little blip where they hit the first tier of the savers credit their their smack in the 12% bracket. Now let's say the one that was making 60,000 says I'm going to go, I'm going to go back to school for two years to get a better nursing degree or whatever. So, that drops out. Well, now that changes things a bit. You know, now you've got someone that good grief that they're in the, they're in the earned income tax credit zone now so you know they're they're saving more than 50%. I'd have to change the scale here. So, whatever it so they're they're actually, you know, if they could afford it now this gets into. Can can they afford it so now only one of them can can possibly contribute but let's say maybe they. They received an inheritance and the moment the fact that they got the inheritance but now they got it they've got this cash that they can live off for a couple of years while one of them goes back for a better Well, you know you might think that they're in the earn $40,000 they're in the bottom of the 12% or top of the 10% even but because of the earned income tax credit they can actually save 80% on at least some amount of traditional contribution.  They do all traditional and they're still at 20% which is, you know, maybe they go traditional, maybe they go, they go off at that's, but 80% they should do traditional. And then, you know when once they get up to contributing 15,000 while they're not paying any tax they're not getting any credit. They should, they should put it all in rough. So that's a quick, it depends answer to your question about can they just go by tax bracket or do they need to look at marginal rate. And the point using a tool like this is it's just very, very fast to get a quick look at what the marginal rates are for someone who's 92 years old and has never used a spreadsheet. I wouldn't suggest this, but you know someone in their 20s or 30s and they use spreadsheets in college. And I don't know something like this. I've created a presentation on this spreadsheet, the personal financial toolbox. I think it was in March for the Chicago chapter, and it is on the Bogle heads. Virtual presentation list. I believe it. I believe it's all there. I think it's in the chat. Yeah, the answer to all the questions, recent questions are yes this, whether it's personal finance toolbox and or the case study spreadsheet it's the same thing. Okay. And it is also in our wiki in the, I think, is it in the tax efficient fund placement wiki or the. It's in the tools and calculators and calculations wiki. Okay. 5k is there a or is there a time at which a point at which the taxes you have paid to convert a traditional to a raw are outpaced by your earnings in the raw that are now tax free. What point would that be how would we see that. That sounds like a return on investment thing and I know that's a hot topic these days. Personally, I don't get the whole return on investment idea of analyzing traditional versus raw.  If you're paying tax, you're paying tax it's just when are you paying it, and at what rate, are you paying it. So it's, you know, it's all about the rate it's not the amount of tax you pay. Because if you go by amount of tax you pay, Roth is going to win every time. Because you pay a little bit of tax now, and after, you know, let's say it's grown 10 fold, well you're going to pay 10 times the amount of tax later, even if it's at the same rate. But it ends up being the same amount after tax so looking at the amount of tax paid is just just not the right way to look at it you've got to look at the tax rates. And so the traditional versus Roth wiki had there's there's a common misconception section. That's the second one. The second one is the one that says look at the amount of tax paid. No that that's a misconception. And the first one, first misconception is that you get to save it a marginal rate but you only pay at a, at your effective rate. Now, you don't get to start from zero on it on every single withdrawal so, but the, that section of the Roth versus traditional wiki covers those, those two common misconceptions one favors Roth one favors traditional but neither one is correct.


Sounds good. Hello. I am guessing people can see me now No, there's no one online yet online Wow, what they show offline? Okay? Anyway, so I'm gonna start So my name is Alejandro Hernandez. I am a doctor developer. I've been working on the doctor project for about five years and and the title of my presentation is developing building and testing your very metal applications using the Yachto project and the open embedded infrastructure. I Work in the Azure Sphere team on on Microsoft and Yeah, I'm just gonna go ahead so the The latest changes that we are seeing in the market is that There's more and more embedded devices that have multiple architectures They're they either have multiple Cores or in the same SOC or it could be different regardless We can see that the trend is that we are Distributing the work depending on the application on different processors or the cloud so small things go on a small processor and then you have a sort of like a big processor where you can have an operating system and then you can have things that you have to Need require computing power go to the cloud This is for example the Azure Sphere device it is a multi architecture embedded device and This is just an example, but and while this is a much more complicated device and focus and security The idea of this thing is that you have to start somewhere and you have to start developing your Bermuda applications you can do that on the Yachto project or open embedded. I'm trying to click Okay, so first I'm going to talk about a little bit about the runtime testing infrastructure That's an open embedded already. I'm going to go back and forth a little bit between The what the application is and the In the infrastructure itself the So it might be confusing, but let me know and I can just go back Weirdly, I am not going to try and focus on the application That could because what's important for me the message that I want to pass on is that what the infrastructure? Allows you to do and how you can take advantage of that regardless if you're using Or building a Linux operating system or building a remote application So I'm going to try and focus a little bit more in that part So first of all, how does it work normally right the Open embedded was in the Yachto project where it's self-designed to build a Linux operating system So the way it works Or the way was assigned the testing infrastructure. It's also for a Linux system How do you test a little system here runtime? You inherit the test image class you set the target the test target as QMU which is said by default you don't have to do anything and You define the test suites that you want to run now There are different test targets that you can set an example is this the QMU one There's another one that you have to put a it's called simple remote And you just define the IP of the target and then it sends commands through SSH And then the test suites They're basically that That that's why you actually test a simple in the case in this case, for example, there's being this SSH SCP parts looks are just examples of the test cases that already exist there and they're being tested on a daily basis it's important that the way that the Test suites are defined that there's the order in which their process matters. So the if you're trying run SCP so for example I put an example here if you put the test suites that's SCP ping and SSH SCP would be skipped because it depends on ping and then ping would be run and then SSH would be run because ping run before that The correct way it's ping and then SSH and then SCP Those are just examples. You can take a look at the directory the meta live OI QA runtime cases and those are all the cases that are available. You can certainly define your own if you Have your own application you want to test it You can just put it there So that's how Linux is tested on an everyday basis. So again the the important thing here is that That's the way it was designed and the what we try to do is how can we without breaking what's already there? How can we Modify that to make it work for different applications Whether they are a different Linux operating system a different operating system our to us or something or a very metal application So this is an example of the tests that when you run the test, I don't know if you can see this It's a bit small. But anyway, if you run the test image task for an image for core image minimal in this case you can see that In this case, it's it's complaining the SSH test is complaining because I didn't put drop bear or open SSH on my image So it can't run it. But either way tell me Tells me some sort of report that I have one success and what's one skip no failures in ours So that's how we normally would look like Okay, so the the modifications that I mentioned before are this ones and These are part of the test image class and also of the key on you a runner A script that that we use as a helper I think it might be easier. Those are the commands that are defined. These are commented out on the class just for information and you can set your own depending on your own needs And these on Fiumi runner. They're defined as the default, but if we I think this will make it clear I can barely see myself, but So what happens here is that there's some sort of a communication between the host and the target and it's has to be synchronized So the host tells the target to start booting and then the target at some point reaches a login prompt Then it tells that the host is constantly reading the output of the target once it's That one to the text that the login prompt is there. He tries to log in as route if you have Debug tweaks on on your image features then what happens is that the target prints out a the root at and then the whole name so There's a pattern that's defined on those variables that I showed previously and That's when the holes the text that there was a success logging in right so after that it tries to send some sort of command let's say ping and Then it checks again for another prompt, which means the command already exited and then it checks the if it asserts the The output of that right so again if we go back here. This is what's defined on on this thing If this uses a syntax very similar to the one on package configs and If you're familiar with that, it's a lot easier that way the you can't override certain Patterns and only do you want to because one of the thing is that for example this by default was only able to log in with Root and that was not modifiable. You can do it like that. So in this case if you have your own Linux operating system and you you're not using the root user You can change that right you can just change the send login user and you can put whatever your user is or if you change the The prompt you can also change that and it'll work. The infrastructure will work for your own Application or operating system so the next part of the presentation is the vermin options and applications on the auto project and I'm gonna Go through it a little bit here. So we've had some progress into Allowing the auto project to build different tool chains one of them is a tool chain for vermin applications and since you already have the tool chain, you can just compile your Sources for that and then you can get a running application up for some Architecture, right? So if you want it there is an example on the auto project on meta skeleton That I put in there. It's called their metal. Hello world. It's a very simple example. There's not It's just a hello world But if you wanted to reproduce that you can just do that following the steps that are on the screen Basically you clone it you add the meta skeleton layer and then you set your machine in this case I set it up for a human arm 64 and the TC leaf see I set it up for bare metal I put that on my local account and I try I run a big bake for bare mouth. No work after that After that after your build is done You can just run run QMU and that's integrated with that as well and it'll run a The application on QMU and you'll see hello open embedded on the on your screen Some interesting targets there are The meta tool chain target if you run big big meta tool change you will end up getting a Bare metal tool chain for arm 64 architectures Very mental hello world and then see populate SDK in this case You wouldn't do anything because it wouldn't add anything to meta tool chain But let's say if you have some sort of dependency for some reason or anything else You could create your SDK that will have a an extra dependency that you require for your application and another thing that's interesting is switching the The TC leaf see so instead of using very metal as I put it here somewhere you Can use TC leaf see and for this specific application? It wouldn't do anything. You wouldn't do anything different because TC leaf see sorry. Newly this is capable of running Burma applications, but newly there is a C library that's meant for embedded operating systems or embedded applications and It'll be able to run it But at the same time it will provide you more things than just the Burma one the Burma one just it's it's Pretty much very bones. The the new leaf has a little bit more things on it Okay, so now how do I'm gonna switch a little bit to the application part so How do you create your bare metal application? Well, I I went and poked around the the source code of QMU and was able to get the address of The you are which is how I wanted to print the the hello open embedded part and So I wanted to rate the data sheet for that in your case for every SOC would be different So you kind of have to go and read the data sheet and then see what Registers you have to write on and stuff like that in this case. I was able to get that I got the the UART address the RAM How how we how QMU sets up the RAM and where it puts the kernel so if you pass the dash kernel argument to QMU it QMU puts it in a certain address, right? So that's what I kind of needed Also, I went and looked at the I'm developer manual and The UART uses a PL 0 1 1 driver and From the arm developers manual you can look at the registers that are used for the UART in this case are there are several Registers that are interesting there. The first one says you are the R which is a data register Then the second one would be the receive status and the clear register and also another important one is the FR the flag register so for the I'm gonna go back a little bit for the Let's share my screen a little bit So for the application that I just showed you here This one that one there's not much that's needed there But it just print out something in the in the screen Okay, I hope you guys can see this so this is just a source code of the The vermin application for that the one that you're seeing on your screen it simply prints hello open embedded and as I said I I had to get the address for the UART base Where it's located and all I do is I Basically try to print a It's string and that string basically just checks when When the when it hits the end of the string While it not it doesn't hit the end of the string it starts putting pointing the the character to the The R-register the data that I register now another interesting thing here is that the There's no main function because it's a very well application. So usually on a Linux or something else you have The C runtime that comes from from Lipsy, right? But in this case, we don't have that so we have to tell we have to be able to tell the The compiler in the linker how is it gonna start the application? So for that we have two different things one of them is the startup code Again, normally you would get this from the C library, but this case. It doesn't have it So I have here a simple startup code for for that and I'm not going to go into a lot of details, but the important thing here is that I Defined a an entry function in this case. You can call it whatever you want. It's called C entry But you can call it main if you want to It because it's just wouldn't we're just gonna jump once it starts executing our Application and then the there's also a linker script that you have to define Again, this is very specific to the architecture that you're building for so depending on the SOC you have to kind of go through the The data sheet and see how all of this is defined So for example the RAM on can you start that zero x4 and a thousand zeros and then So when one of the things that I said that oh well poking around and in the community source code You can see that once it gets the kernel Argument it adds another zero x1 zero zero zero So that's how that's the address that I'm actually using then I define the different sections of my binary the text section the data section And stuff like that and in the stack right so that thing you need to pass to the compiler so it knows how to organize your binary basically and again This This is what the code actually looks like but while compiling it has to first assembly the Assemble sorry it has to first assemble the startup code and then compile the application as an object file and then link Link it with the startup code and with using that linker script that you define yourself So this is a very simple one. This is just the hello open embedded and the idea here is That okay, how do I going back a little bit? Yeah, so going back a little bit to the how do I use a test infrastructure from open embedded? This is kind of what my Local.com phase is looking like at this point I set up my machine SPM yarn 64. I changed it the CC leapsy I changed it to new live and as I said before as a bill I was tested Linux. I said inherit and then test image And then the test switch I define my own test switch and I was lazy enough that I just used the one that I already have It's called free art those echoes So I defined a free art those tests just so I know that free art those Gets built every day and it's built correctly with the the new changes in In open embedded. I can actually show you that second So that would be Somewhere for some reason I cannot see that one second there's an application missing from my Skillshare for some reason Okay, I hope you can see that so there's a free art those layer and I just used that I put a A test case here as I said So this is what a tested test case looks like and it's very simple. You just have to put it on the right path I hope you I hope you can see what I'm selecting with the mouse right now So this is what a test case test case looks like it's very simple I in my application I define a special character, which is the distant so that it has a known behavior and I know what I'm gonna get from that when I send that command through this Serial interface, right? So I was lazy and I decided to use the same test case for this one I just defined a different behavior for that. So for example in this case Actually one second so This is a little easier this way Okay, so in this case I define where is this here? I define the following patterns that I wanted to look for again. This is part of the synchronous communication that has to happen the I define the search So I'm gonna check if I reach prompt What I'm just saying I'm gonna check for is ELC 2020 then the login user is gonna be covered 19 the login succeeded so basically when the application tells me that It it knows the user code 19 It's it says not welcome and then the command finished is just a new line. So the new The new workflow or the new flow looks like this So the host tells the target to start booting and then the target at some points prints out ELC 2020 The the target itself. No, sorry the host Sends COVID-19 In the care of return and then the target says not welcome and then the whole says okay So I logged in correctly and then it just looks for different commands every time For every new line and it just reads that that part So I'm gonna go live. It's a little bit weird because I don't have any feedback from I don't know if people are Listening to this or not. Anyway So That's how the pattern is set up like this is oh, this is just how I clone the free articles Layer and then I added it to my baby layers.com and I modified it a little bit I just put a two warnings there of what I was sending in the output that I was getting and I Modified a little bit because I wanted to look for success instead of as you can see from the previous slide instead of The prompt I would get success from the application So if I run that If I run that I can I should be able to get something similar to this This is a screenshot of how that looks like so if I run that I am able to run it says that I run the free articles Test the echo test and then that it passed so it got the command correctly. So it says I send the command that and then I was able to read the output and it said success Which means the application is working and this is something that you would set up for like a CI or something like that that you you want to make sure that your Application it's being built correctly and changes to it if there's several things that are changing it or whatever You have to make sure that it's it's it's working every single way, right? I don't I'm not a huge fan of screenshots. So I will kind of turn my screen right now So you guys can see it running yourselves and I modified it. I hope it works. Um So I just ran test image for there it is so I just ran test image for a bit more hello world and Again, it says it sending command The till the or whatever you call it and then it got a success with a character turned there and then the the test itself passed Just to prove to you that I'm not lying I can go and look at the Layers where my layers layers Meta free articles and then live or if you a runtime cases and then I have two cases there But I'm using the echo one Again, this is just what the test case looks like that's what what's being run by QME runner and The application in this case also I changed the application a little bit I'm gonna show you that right now because the original one was simply printing Hello open embedded, right? So For that I will I'm gonna go into the source code and I'm gonna read some of them So this is this is the new application that I Modified it's based on the same thing, but it has a couple of extras right now Again, as I mentioned before I switch from using Tc-LiPc bare metal to Tc-LiPc new lip and the reason for that was because I wanted this kind of stuff here So I I'm able to get standard in and standard and strength from the C library I defined other registers if you remember on the On the bare metal one, I only needed the data register which was this one So all I needed was this and I only knew what's the point What I was what I wanted to print there But this is a little bit more complicated because I wanted since I wanted to have that synchronous communication to the target and the host I Had to define some of the things and these are the ones I'm gonna go back real quick. These are the ones that I got from Here so from the I'm developers manual from the PL 0 1 you are You can get the correct registers for that in how the offsets are set up so Okay, so the important thing here is that I define a the the flag register it's It's it's offset. It's a fine here It's off that the offset for the received status and clear register offset is defined here And then I've defined some masks because I need it for the specific the flag register You have to get certain bits of it. So That's that's what I used to get those bits. I define a couple of functions here with you are put your you are zero print you are zero and then check command This can easily be a strap, but I wanted to make it clear and define it differently. So Again, so these are these are how the functions are defined I'm gonna go through the end and try to like kind of go through it real quick So first of all, I have my C entry function and I have the same thing as before I have a print the you are zero. Hello ELC 2020 and then I have a while that pretty much just reads the you are whatever it gets from the you are and then It echoes it And at the same time it tries to check if we reach the end of the line If we reach the end of the line, it calls the check command function For the print the print Changed a little bit. So the read the read your function is here and It basically just checks the pointer for the flag register and gets the correct bit From from there, right, and then if if that If it's able to read something from there then It gets it and then it puts it on the on the you are and if not it returns an error For the print itself This function is pretty much the same as the other one. The only difference is the I'm printing our character by character here. And again, I have to read I have to mask the flag register For the bit that I actually want and if I'm able to put something on the data register I can print it and then I print character by character, right? And then the last interesting thing here is the tech command, which is basically just a switch case But you can do that here. So you have to string compare that and this is something also that you get from new live, right? this kind of functions So basically checks the buffer that I define For for the user in this case and then it tells whatever string that I wanted to find So I'm not welcome in this case cover 19 and then not welcome and then it also checks for the known behavior that I mentioned before in the test case and then it says Success otherwise it just says unrecognized command. So I can actually go ahead and test this So if I just run run QMU everything in the application is already defined so it mimics an image a Linux image. So it just sort of Interacts correctly with the OE infrastructure that set up for Linux So in this case as you can see The string that it being printed. It's hello ELC 2020 and then if I put 19 it says not welcome. You're not welcome and then if I was running the test case, I would put this and Hit enter and then I get success, right? So that means that the application itself. It's working and then whatever else I type is gonna say unrecognized command now be This is that the part where I was mentioning that I'm not gonna try and focus on what the application does a lot because that's kind of up to you What you can create is up to you. This is meant to be a some sort of example of How you can create your Or a base, I guess How you can create your bare metal application using either the bare metal toolchain or the new lip toolchain And uh, use the test infrastructure coming from up and embedded to test your application So if you wanted to do something different, uh, and yeah, you wanted a different, uh, Bare metal application all you kind of have to do is, uh modify Uh modify this work scope and then instead of Checking the command and print in that success. You can actually do something interesting like reading some sensor from the adc or You know manipulating some led or or gpio or whatever, right? That that's up to you But the the basis of it it's it's already there. Um, another thing that I'd like to mention is that, um So when you're using new lip, this is this is sort of like a hybrid because it's using Parts of the bare metal one and parts of new lip. Technically you can get the z runtime You can get it from lip gloss. Uh, if your architecture is supported So if you wanted to make it portable and do this Correctly for your specific so see you would patch New lip or lip gloss in this case to get the c runtime correctly for all the applications that are meant to be run on your architecture Uh, that will allow you to get rid of that part for the startup code that would just get you would just get that from new lip and lip gloss and in the The linker script as well um I think that runs it. Um, oh I actually modified it Again, give me one second um so I created a different branch I'm pretty much done if you guys want to ask questions Um, I noticed in the other presentations that the questions take a little bit to get here. So if uh, uh, if you guys can't If I can't see the question feel free to reach out later. Um, so I created a different branch here in your branch and Supposedly I can't scope there. So if I recompile this Um, I'm recompiling the application with a different source code It goes through all the process there I just have to run KMU And then it says hello ELCE and then COVID-19 Not welcome and then if I wanted to test my image Please wear a mask because I'd like to present in person at ELCE and that's it. Uh, I'm going to go through the questions now Let's see. This is a little bit small. I'm going to see you Lots of you are listening cool um So one second It says can the uh Can the vermin recipe depend on other recipes? If yes, can they be built with teammate and should they be built as a static library? Uh, yes, they can depend on Oh, let me show you one more thing um Yes, they can depend on other recipes again, um It it works with the build system itself. That's that's what we try to do We try to integrate it with the build system how it works right now So if you put something on the pens, it's gonna be there, right? So for in this specific case, I I can show you the recipe for Do I think yeah, so I think this is a this is what the recipe looks like and that's a meta skeleton, right? And there is Okay, no, there's no depends there because when when I set up the Uh PC leapsy new leaf you automatically get new live as a dependency, right? But the idea here is that if you both the recipe Oh, this is not correct Um recipe sister and then user live Uh, you can see that I have leave c that a which is new live in this case Uh, so yeah, you can depend on other things as well. And one other thing is that I had to pass Oh, this is it Uh, a new live the noses root does not work. Uh, it's not set up that way So I had to pass somehow in this case. I just hacked it, but I had to pass The search directory for libraries, uh on the recipe the Makefile itself has A Where is this here it is? So these are this is what the makefile looks like and then it it's it's try to I try to set it up in a way that it's understandable Um, so it assembles compiles and links, but the important part here I want to want to show you is this part which is passing, uh, the leapsy that a And it's specifically passing it as a static library So yeah, thanks for your question. Yes um Let's see Uh The I have another question here. It says, uh, is this uh free articles in the yachter project nightly regression testing No, it is not, uh No, it is not, but yes, so I have my own testing For the since it's the free i'm the maintainer of the free articles later. So I sort of uh Tested myself. So Here I have my this is the free articles. No, this is not the free articles later. This is the free articles later. It's on github Um, it says it failed, but don't don't worry about it. I already fixed it Uh, so this is being tested on a nightly basis. Uh, every day it is being tested a master done fail See you as in a wire and actually you can get the artifacts from here um Just to show you that it actually works. So Master next here is master next. I pushed it 14 hours ago So, yeah, this actually tests two things it tests, uh free articles and it also tests the, um Uh multi-config uh belts. So it builds, uh pokey for one architecture and free artists for a different architecture I think it builds, uh, x86 64 pokey and then free articles. I'm not entirely sure Uh, yeah, so so it is being tested on a daily basis. It's not being tested as part of the Out of belter from from the octo project um I don't think I have any other questions So, yeah, uh, if you guys, uh, have more questions, uh, feel free to reach out My email is alejandro.herlanders at microsoft.com. Um, and yeah, uh, anything just see just people to reach out Thank you guys, and I hope you enjoyed it Bye